Skip to content

test: spike E, the impact table measured on PostgreSQL 16 and 18 and SQL Server 2022 - #60

Merged
CaffeinatedCoder merged 4 commits into
mainfrom
spike/20-impact-table
Nov 12, 2026
Merged

CaffeinatedCoder merged 4 commits into
mainfrom
spike/20-impact-table

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Closes #20

Problem

The plan's section 3.7 has four answers a contributor gives for an operation of EF Core's on something its object depends on (Unaffected, Follows, Lost, Blocks), and no table of what the servers actually do. 5.x learned it one bug at a time. The planner (#24) needs the table first.

Change

  • spikes/E.ImpactTable: a test per cell. A cell creates a table and one object, runs the statements the provider's own IMigrationsSqlGenerator writes for the operation, and reads the catalog. Expected.cs is the table as measured; a server that answers otherwise fails the cell.
  • design/schemakit-core-plan.md, section 3.7: the two tables and what they say beyond their cells.
  • .github/workflows/dotnet.yml: the Spikes job gets PostgreSQL 16 and SQL Server 2022 as services, and puts the measured tables into the job summary.

What was measured

PostgreSQL 16 and 18 answer alike in every cell.

PostgreSQL 16 and 18 Rename column Alter, type Alter, nullability Drop column Rename table Schema move Drop table
Index on the column, an expression of it, with it in INCLUDE, or in its predicate Follows Unaffected Unaffected Lost Follows Follows Lost
Exclusion constraint, column as an element Follows Unaffected Unaffected Lost Follows Follows Lost
Exclusion constraint, column in the predicate only Follows Unaffected Unaffected Blocks Follows Follows Lost
Trigger UPDATE OF the column, or with it in WHEN Follows Blocks Blocks Blocks Follows Follows Lost
Trigger whose function body reads the column Stale Unaffected Unaffected Stale Follows Follows Lost
SQL Server 2022 Rename column Alter, type Alter, nullability Drop column Rename table Schema move Drop table
Index on the column, or with it in INCLUDE Follows Blocks Unaffected Blocks Follows Follows Lost
Filtered index whose predicate reads the column Blocks Blocks Blocks Blocks Follows Follows Lost
Trigger whose body does not name the column Unaffected Unaffected Unaffected Unaffected Follows Follows Lost
Trigger whose body reads the column, IF UPDATE included Stale Unaffected Unaffected Stale Follows Follows Lost

To decide with the maintainer: Stale is a fifth outcome and the union has four. A trigger whose body reads a column stays in the catalog through the column's rename and drop and fails when it next fires, so every write to the table fails. Lost would leave it in place. Blocks has the right action (drop before, create after) and the wrong name, since the operation does not fail. Either its meaning is documented as "rebuild around the operation" or it is renamed before the contract freezes. Noted on #24.

Other findings, each in the plan:

  • PostgreSQL drops an index with a column in silence also when the column is only in its predicate; an exclusion constraint with the same predicate blocks the drop.
  • On PostgreSQL a nullability-only AlterColumn blocks under a trigger, because Npgsql writes ALTER COLUMN … TYPE for every AlterColumnOperation.
  • PostgreSQL rebuilds an index and an exclusion constraint under a new OID on a type change. The spike's first run reported them as lost for that reason; it now looks an object up by name.
  • SQL Server allows a nullability change under a plain index. 5.x had recorded ALTER COLUMN as refused under any index; that is true of a type change.

Not measured: nullable to not null, a clustered index, a computed column, and SQLite.

Tests

Locally, on SDK 11.0.100 against postgres:16-alpine and postgres:18 in Docker: 132 passed, 52 inconclusive (the SQL Server cells). The SQL Server image does not start under emulation on this machine, so its cells were measured in CI, where an unset server fails instead of going inconclusive.

That a cell fails when the server answers otherwise is shown by this PR's first complete run: two SQL Server cells had been written from 5.x's record (Blocks for a nullability change under a plain index) and failed with what the server did.

Every_operation_succeeds_on_a_table_nothing_depends_on is what makes Blocks the object's doing; The_table_is_complete fails when an object or an operation has no expected cell.

🤖 Generated with Claude Code

…lusion constraint and a trigger, measured on live servers

PostgreSQL 16 and 18 are measured and pinned. The SQL Server rows are what
5.x recorded, to be replaced by the first run on a server.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 12, 2026
@CaffeinatedCoder CaffeinatedCoder added tests Adds or changes tests only (harnesses, parity suites); no library code package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL package/sqlserver Affects CodoMetis.EFCore.SchemaKit.SqlServer area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 12, 2026
@CaffeinatedCoder
CaffeinatedCoder marked this pull request as ready for review November 12, 2026 08:16
@CaffeinatedCoder
CaffeinatedCoder merged commit e9ffa0f into main Nov 12, 2026
7 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the spike/20-impact-table branch November 12, 2026 08:20
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 package/sqlserver Affects CodoMetis.EFCore.SchemaKit.SqlServer 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 E: measure the impact table on live servers

1 participant