Skip to content

fix: correct wire protocol type OIDs for pre-existing SQLite tables (#68)#74

Merged
erans merged 5 commits intomainfrom
feat/wire-type-oid-fix
Mar 28, 2026
Merged

fix: correct wire protocol type OIDs for pre-existing SQLite tables (#68)#74
erans merged 5 commits intomainfrom
feat/wire-type-oid-fix

Conversation

@erans
Copy link
Copy Markdown
Owner

@erans erans commented Mar 28, 2026

Summary

  • Add sqlite_type_to_pg_type_name helper to map SQLite declared types to PostgreSQL type name strings
  • Add get_column_types_from_pragma method to DbHandler that uses PRAGMA table_info as a fallback for tables without __pgsqlite_schema metadata
  • Add PRAGMA type fallback in simple query protocol (executor.rs) and extended query protocol (extended.rs) — covering Parse-time schema_types, Execute-time schema_types, and Parse-time inferred_types paths
  • Skip empty and default-text PRAGMA types to preserve value-based inference for untyped/virtual table columns

Fixes #68 — integer, bigint, smallint, boolean, and float columns in pre-existing SQLite tables now report correct OIDs instead of always returning OID 25 (TEXT).

Test plan

  • All 487 unit tests pass
  • All integration tests pass (datetime, pg_index, etc.)
  • cargo check — no errors
  • cargo clippy — no new warnings in changed files
  • Verify with psycopg3 binary protocol that pre-existing SQLite tables return correct type OIDs

🤖 Generated with Claude Code

erans and others added 5 commits March 27, 2026 18:05
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add PRAGMA table_info fallback for type inference in the extended
protocol's Parse-time schema_types, Execute-time schema_types, and
Parse-time inferred_types paths. Skip empty and default-text types
from PRAGMA to preserve value-based inference for untyped columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erans erans merged commit 56fa9a7 into main Mar 28, 2026
1 check passed
@erans erans deleted the feat/wire-type-oid-fix branch March 28, 2026 03:28
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.

Wire protocol: type oid is incorrect for integer and float types

1 participant