Skip to content

Spike G: the server's own text for a declared object - #264

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
tests/255-spike-g-catalog-text
Nov 28, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
tests/255-spike-g-catalog-text

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #255

Problem

The catalog verifier (#30) has to say whether an expression key or a condition in the database is the declared one. The catalog holds the server's own text and a declaration holds the package's: "Tag" <> 'blocked' is (("Tag")::text <> 'blocked'::text) there. Nothing in the repository says how the two can be compared on a production database, where the tests' way, a second database built with EnsureCreated(), is not at hand.

Change

spikes/G.CatalogText, throwaway code on Npgsql alone. ShadowKit.cs creates the declared object on a temporary table that has the real table's name and columns, in a savepoint that is rolled back, and reads it from the catalog as the real one is read. Questions.cs is one test per question of the issue, on PostgreSQL 16 and 18. The README has what was measured, what it takes and what it does not show.

CLAUDE.md names the spike and its command. The Spikes lane runs it with spike E's servers, since it reads SPIKE_E_PG16 and SPIKE_E_PG18 where its own variables are not set.

The answer is in #30, with the maintainer's decision of 2026-11-28: the shadow, for the objects that need it. #259 builds it.

Tests

90 tests, 45 on each of PostgreSQL 16.15 and 18.1.

Each mechanism of ShadowKit.cs was taken out in turn:

Taken out What failed
The column's own collation in the shadow table 12: every key or expression over the column with COLLATE "C"
The real table's name for the shadow table 8: SQL that names its table, the row as a whole, and the two tests that read the shadow by that name
The savepoint 6: the transaction is lost after a statement the server refused, and the caller's with it
The column type's modifier Nothing. The README says so: no case was found where it makes another text

Measured by hand and not by a test: a standby, made with pg_basebackup inside the test container, refuses the shadow with 25006 and reads the catalog, on both versions. The test holds a read-only transaction, which fails with the same SQLSTATE.

🤖 Generated with Claude Code

For the catalog verifier (#30): an expression key and a condition are text
of the server's own in the catalog, and a declaration holds the package's.
The spike has the server write the declared object on a temporary table
with the real table's name and columns, in a savepoint that is rolled
back, and compares the two as the catalog states them.

90 tests on PostgreSQL 16 and 18. The README has what was measured, what
it takes and what it does not show.

Closes #255

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 28, 2026
@CaffeinatedCoder CaffeinatedCoder added tests Adds or changes tests only (harnesses, parity suites); no library code package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 28, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit dd5db80 into main Nov 28, 2026
10 of 11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the tests/255-spike-g-catalog-text branch November 28, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL tests Adds or changes tests only (harnesses, parity suites); no library code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spike G: can the server say what a declared expression is, for the verifier?

1 participant