Message-ID: From: "fdcastel (@fdcastel)" To: "postgresql-interfaces/psqlodbc" Date: Thu, 12 Feb 2026 19:47:25 +0000 Subject: [postgresql-interfaces/psqlodbc] PR #155: Fixes for #153 List-Id: X-GitHub-Author-Id: 629408 X-GitHub-Author-Login: fdcastel X-GitHub-Issue: 155 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-State: merged X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/pull/155 Content-Type: text/plain; charset=utf-8 This PR applies the [four recommendations](https://github.com/fdcastel/odbc-crusher/blob/master/recommendations/postgresql_ODBC_RECOMMENDATIONS.md) 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.