Skip to content

validation: route ingest readback through an IngestSelectRoundTripQuery quirk - #10

Open
fornwall wants to merge 1 commit into
mainfrom
validation/ingest-readback-projection
Open

validation: route ingest readback through an IngestSelectRoundTripQuery quirk#10
fornwall wants to merge 1 commit into
mainfrom
validation/ingest-readback-projection

Conversation

@fornwall

@fornwall fornwall commented Jul 9, 2026

Copy link
Copy Markdown
Owner

The TestSqlIngest* templates read ingested rows back with a hardcoded
SELECT * FROM "bulk_ingest" ORDER BY .... That string is unportable for
drivers with a different SQL dialect, in two ways:

  1. Identifier quoting. Double-quoted identifiers are not valid
    GoogleSQL (Spanner needs backticks), so the readback query fails to parse.
  2. Synthetic primary keys. A driver whose create-mode ingest must add a
    synthetic primary-key column (Spanner requires a PK) has that extra column
    leak through SELECT *, breaking the templates' single-column schema and
    value assertions.

This adds a backward-compatible DriverQuirks::IngestSelectRoundTripQuery
hook that projects only the ingested columns the test asserts on, letting a
driver override both the projection and the identifier quoting (e.g. emit
SELECT <columns> FROM `bulk_ingest` ORDER BY <col>). The default
reproduces the exact historical SELECT * FROM "table" ORDER BY <body>
string, so existing drivers see identical SQL and behavior is unchanged.

The five ORDER BY readback sites (the numeric/temporal/interval type
templates, TestSqlIngestMultipleConnections, and TestSqlIngestSample)
are routed through the hook, passing the asserted column name(s) and the
existing ORDER BY body verbatim. Together this un-blocks the SqlIngest*
family for drivers that (a) quote identifiers differently and (b) add a
synthetic primary-key column on create-mode ingest.

🤖 Generated with Claude Code
https://claude.ai/code/session_01JtLEb7yAhv2qAZFoSbzKjp

…ry quirk

The TestSqlIngest* templates read ingested rows back with a hardcoded
`SELECT * FROM "bulk_ingest" ORDER BY ...`. That is unportable for a
GoogleSQL/Spanner-style driver: double-quoted identifiers aren't valid
GoogleSQL, and a driver that adds a synthetic primary-key column on
create-mode ingest leaks that column through `SELECT *`, breaking the
single-column readback assertions.

Add a backward-compatible `DriverQuirks::IngestSelectRoundTripQuery`
hook that projects the ingested columns explicitly. Its default
reproduces the exact historical `SELECT * FROM "table" ORDER BY <body>`
string, so existing drivers see identical SQL; a driver can override it
to project only the named columns with its own identifier quoting.

Route the five ORDER BY readback sites through the hook.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JtLEb7yAhv2qAZFoSbzKjp
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.

1 participant