Skip to content

Add sqlr_test_types() to round-trip every type in each dialect - #11

Draft
nbenn wants to merge 1 commit into
mainfrom
10-type-conformance
Draft

nbenn wants to merge 1 commit into
mainfrom
10-type-conformance

Conversation

@nbenn

@nbenn nbenn commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The dialects' round-trip tests list their types by hand, so a type nobody listed goes unexercised. Core now ships the list as sqlr_conformance_types(), one entry per type class and per value of each parameter it carries, and a core test fails when the IR gains a class or parameter the list does not cover.
  • A dialect's test suite calls sqlr_test_types() with a function that opens a connection. Each entry becomes its own test, which renders a one-column table, creates it, reflects it and fails with the sqlr_diff() lines unless nothing changed. Types the dialect cannot represent are declared in skip with a reason and skipped citing it; an unknown name is an error.
  • Core's suite has no database, so the round trip itself runs downstream. Run locally against both dialects' current main, it finds the 8 SQLite renderer losses listed in the issue (tinyint passes since Reflect column types with this dialect's own mapping sqlr.sqlite#2) and 6 on Postgres, where tinyint does not render, integer_unsigned reads back as integer, numeric_precision with scale 0, char_unsized as char(1), and varbinary and binary as an unbounded bytea. Both dialects adopt the helper in their own PRs once this is on main, since they install sqlr from there.
  • DBI joins Suggests, for the helper only.

Fixes #10

The dialects list the types their round-trip tests cover by hand, so a
type nobody listed goes unexercised. Core now ships the list and a
helper that runs each entry against a live connection, skipping what a
dialect declares it cannot represent. Table names carry the process id
so concurrent runs against a shared server do not collide.
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.

Round-trip every modelled type in a shared dialect conformance test

1 participant