Repository navigation
v0.3.0
The Spanner provider on provider contracts 25.37 and 25.39
This release stops replacing, on every plan, most views whose query Spanner
rewrites, and refuses a drop that a change stream names before any statement
runs. Its support level is still best effort, measured against
pgadapter-emulator v0.56.2; the managed service and GoogleSQL are not
covered.
Which Ptah it needs. The provider is built with provider-sdk v0.37.0
(contract 25.39). It still starts on a Ptah of provider contract 25.27 or a
later minor of 25, and serves an older minor without the additions it does not
list. The view query decisions need contract 25.37 and the plan-time refusal
of a drop needs contract 25.39; Ptah v0.24.0 speaks both. With Ptah v0.23.0
the provider compares views as v0.2.0 did, and refuses a drop a change stream
names when the statements run.
What changed
-
Views Spanner rewrites (#30, contract 25.37). Spanner stores its own
spelling of a view's query: casts on literals, parentheses,INas= ANY (ARRAY[...]),BETWEENas two comparisons, a table alias withoutAS,
every column of aSELECT *named and the columns of aUNIONqualified.
Ptah compared the texts, so such a view was replaced withCREATE OR REPLACE VIEWon every plan. The provider now reads both queries into one form,
typed by the declared columns Ptah sends, and answers that they are one
query when the forms match. It leaves every other pair to Ptah's own
comparison, so no view that converged with v0.2.0 replans. Of 33 view shapes
measured, 21 were replaced on every plan; with Ptah v0.24.0, 3 are: the
CASE, cast and subquery shapes. Declare those in the spelling Spanner
stores to stop the replacement. -
A drop a change stream names, refused before the first statement (#31).
Spanner refusesDROP TABLEof a table a change stream names in itsFOR
clause, andDROP COLUMNof a column one names in its column list, only
when the statement runs, soptah schema applystoppedPARTIALwith the
statements before the drop applied. Before the first statement of a run, the
provider now readsinformation_schema.change_stream_tablesand
change_stream_columns. When a statement drops what a stream names, nothing
runs, and the reason names the statement, the table or column and the
stream:unit 2 of 2 drops table "t", which change stream "cs1" names, so no unit ran: Spanner refuses to drop a table a change stream names; drop the change stream, or alter it to stop tracking the table, before dropping the tableA stream
FOR ALLnames nothing, and a streamFOR tnames no column of
t, so neither stops a drop. A run that drops or alters the stream before
its drops goes on, and Spanner decides those drops. The check works with any
Ptah and covers a migration written by hand.ptah migrations upruns each
statement on its own, so the statements before the drop have run, and the
revision row records the provider's reason instead ofSQLSTATE P0001. -
The same drop, refused at plan time (#33, contract 25.39). A read reports
the change streams that name each table or some of its columns
(schema.removal-blockers), and the planner refuses the drop before a
statement exists.ptah schema apply --dry-runandptah migrations generaterefuse it too, and generate writes no file:dropping table "t": change stream "cs1" names it, and Spanner refuses to drop a table a change stream names; drop the change stream, or alter it to stop tracking the table, before dropping the tableA Ptah older than contract 25.39 plans the drop, and the check above refuses
the run. -
A changed enum list (#32). A changed list of an enum column's values
planned nothing. With Ptah v0.24.0 the plan drops and adds the column's
CHECK, and the next plan is synced. The provider needed no change; this
release adds the live test and the documentation. Spanner runs the drop and
the add one at a time, so when a row breaks the newCHECKthe table is
left without it: check the rows before you narrow aCHECK, an enum's list
included.
Ptah v0.24.0 also fixes two Spanner paths on its own side. ptah schema apply --lock-timeout and PTAH_LOCK_TIMEOUT bound the wait for the provider's
lock, where the flag was refused and the variable reported as ignored. The
down file of a migration that adds a column with its own CHECK or foreign
key drops the constraint before the column, which Spanner requires.
Install it with ptah providers install spanner.