postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: fdcastel (@fdcastel) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] PR #155: Fixes for #153
Date: Thu, 12 Feb 2026 19:47:25 +0000
Message-ID: <[email protected]> (raw)

This PR applies the [four recommendations](https://github.com/fdcastel/odbc-crusher/blob/master/recommendations/postgresql_ODBC_RECOMMENDATIONS...) outlined by Claude after reviewing the [ODBC Crusher](https://github.com/fdcastel/odbc-crusher) report referenced in #153.

-----

## ODBC Conformance Improvements

This PR addresses 4 low-severity ODBC conformance issues identified by ODBC Crusher v0.4.5 testing against psqlodbc v16.00.0000, as documented in `docs/postgresql_ODBC_RECOMMENDATIONS.md`.

### Changes

**1. Implement `SQL_ATTR_CURSOR_SCROLLABLE` setter (Level 2)**
- `pgapi30.c`: Changed `SQL_ATTR_CURSOR_SCROLLABLE` from unconditionally rejected to a functional setter
- Maps `SQL_SCROLLABLE` → `SQL_CURSOR_STATIC`, `SQL_NONSCROLLABLE` → `SQL_CURSOR_FORWARD_ONLY`
- Improves compatibility with ODBC 3.x frameworks that prefer this attribute over `SQL_ATTR_CURSOR_TYPE`

**2. Properly reject unsupported async execution**
- `options.c`: Return `SQL_ERROR` (SQLSTATE `HYC00`) when `SQL_ASYNC_ENABLE_ON` is requested
- Previously returned `SQL_SUCCESS` while silently ignoring the setting, violating the principle of least surprise
- `SQL_ASYNC_ENABLE_OFF` remains a successful no-op

**3. Fix SQLSTATE for invalid `SQLGetInfo` types**
- Added `CONN_INVALID_INFO_TYPE` (215) error code
- `info.c` + `environ.c`: Return `HY096` (invalid information type) instead of `HYC00` for unrecognized info types
- Aligns with ODBC spec requirement distinguishing invalid vs. unimplemented features

**4. Fix SQLSTATE for invalid connection attributes**
- `environ.c`: Added explicit `CONN_OPTION_NOT_FOR_THE_DRIVER` → `HY092` mapping
- Previously fell through to generic `HY000`; now returns spec-compliant `HY092` (invalid attribute/option identifier)

### Testing
- Added 3 regression tests: `cursor-scrollable-test`, `async-enable-test`, `odbc-conformance-test`
- All tests pass on Windows with PostgreSQL 17

### Impact
Low-severity spec compliance improvements. No breaking changes. The driver already supported all underlying functionality; these changes improve error reporting and API surface consistency with the ODBC 3.x specification.

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://postgresql-interfaces/psqlodbc
  Cc: [email protected], [email protected]
  Subject: Re: [postgresql-interfaces/psqlodbc] PR #155: Fixes for #153
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox