Skip to content

Use signed type for error status#193

Merged
davecramer merged 5 commits into
postgresql-interfaces:mainfrom
jarvis24young:codex/use-signed-error-status
Jul 1, 2026
Merged

Use signed type for error status#193
davecramer merged 5 commits into
postgresql-interfaces:mainfrom
jarvis24young:codex/use-signed-error-status

Conversation

@jarvis24young

@jarvis24young jarvis24young commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Problem

PG_ErrorInfo.status is currently declared as UInt4, but it stores signed diagnostic codes.

Statement warnings are explicitly represented by negative values, for example:

  • STMT_ERROR_IN_ROW = -6
  • STMT_TRUNCATED = -2
  • STMT_INFO_ONLY = -1

Descriptor warnings also use negative values. The diagnostic value flows through the following path:

StatementClass.__error_number (int)
    -> PG_ErrorInfo.status (UInt4)
    -> ODBC NativeError (SQLINTEGER)

As a result, a negative warning is first converted to an unsigned value and later converted back to a signed SQLINTEGER. The latter conversion is implementation-defined when the unsigned value is outside the signed range, and stricter compilers report a signed/unsigned conversion warning.

Change

Change PG_ErrorInfo.status from UInt4 to Int4.

This makes the field consistent with its existing value domain and keeps negative warning codes signed throughout the diagnostic path.

Int4 and UInt4 are the corresponding signed and unsigned int types, so this change does not alter the structure size or alignment. Existing positive error codes are unaffected.

Validation

Built both the ANSI and Unicode drivers on Linux with GCC:

./bootstrap
./configure --with-unixodbc=__without_odbc_config
make -j4

The build completed successfully.

y00949552 and others added 5 commits June 29, 2026 16:32
slproweb.com no longer hosts the 3.5.6 installer (returns 404), which
broke the Windows CI download step. Bump to 3.5.7, which is available.
The GitHub Actions windows runner image rolled to Visual Studio 18.0
(VS 2026, MSVC 14.51). The build scripts' hardcoded version switches only
recognized up to VS 17.0, so Find-MSBuild threw 'Please use VC10 or later'.
BuildAll.ps1 caught that and returned without compiling any drivers, and
the WiX step then failed with confusing 'cannot find psqlodbc30a.dll'
errors.

Map VS 18.0 to MSBuild toolset 18, PlatformToolset v145 (VS 2026's
toolset; v144 was skipped by Microsoft), and reuse the vs2022 mimalloc
project files (the pinned mimalloc submodule has no vs2026 ide dir; the
build passes PlatformToolset=v145 explicitly).
The install step configured the postgresql-x64-17 service to auto-start
but never started it in the current job, so tests had no server to
connect to. Explicitly start the service and wait briefly for it to
accept connections.
timeout /t requires interactive console input, which GitHub Actions does
not provide ("ERROR: Input redirection is not supported"). Use
ping -n 6 127.0.0.1 as a ~5s delay that works in non-interactive shells.
@davecramer davecramer merged commit b808804 into postgresql-interfaces:main Jul 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants