Fix ODBC conformance for numeric types (1.3)#183
Merged
staticlibs merged 1 commit intoduckdb:v1.3-ossivalisfrom Jul 3, 2025
Merged
Fix ODBC conformance for numeric types (1.3)#183staticlibs merged 1 commit intoduckdb:v1.3-ossivalisfrom
staticlibs merged 1 commit intoduckdb:v1.3-ossivalisfrom
Conversation
This is a backport of the PR duckdb#177 to `v1.3-ossivalis` stable branch. This change addresses multiple ODBC specification conformance issues discovered during a thorough audit of GetColumnSize() and GetDisplaySize() implementations. Issues fixed: 1. DECIMAL/NUMERIC precision and scale reporting - SQLColAttribute/SQLDescribeCol incorrectly reported column sizes - Fixed GetColumnSize() to return precision instead of precision+scale 2. Signed/Unsigned integer display sizes - GetDisplaySize() now correctly distinguishes signed vs unsigned types - UTINYINT: 3 chars, USMALLINT: 5 chars, UINTEGER: 10 chars, UBIGINT: 20 chars - TINYINT: 4 chars, SMALLINT: 6 chars, INTEGER: 11 chars, BIGINT: 20 chars 3. TIME/TIMESTAMP fractional seconds precision - Added GetTemporalPrecision() to detect precision from LogicalTypeId - Added missing type mappings for TIMESTAMP_MS, TIMESTAMP_SEC, TIMESTAMP_NS - Fixed GetColumnSize() to return full column size per ODBC spec: * TIME: 8 (base) or 9 + precision * TIMESTAMP: 19 (base) or 20 + precision - Fixed GetDisplaySize() to include fractional seconds in display size - Updated FillIRD() and SQLDescribeCol to set precision/scale for temporal types Implementation details: - include/api_info.hpp: Added GetTemporalPrecision(), updated size calculations - src/api_info.cpp: Added missing timestamp variant type mappings - src/common/duckdb_odbc.cpp: Set temporal precision/scale in IRD - src/prepared.cpp: Handle temporal types in SQLDescribeCol - test/: Added comprehensive test coverage for all fixes All changes verified against DuckDB behavior and ODBC specification. All 79 tests passing with new test coverage added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of the PR #177 to
v1.3-ossivalisstable branch.This change addresses multiple ODBC specification conformance issues discovered during a thorough audit of GetColumnSize() and GetDisplaySize() implementations.
Issues fixed:
DECIMAL/NUMERIC precision and scale reporting
Signed/Unsigned integer display sizes
TIME/TIMESTAMP fractional seconds precision
Implementation details:
All changes verified against DuckDB behavior and ODBC specification. All 79 tests passing with new test coverage added.