Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 08 Nov 05:38
· 8 commits to master since this release
6fb0224

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, IN as = ANY (ARRAY[...]), BETWEEN as two comparisons, a table alias without AS,
    every column of a SELECT * named and the columns of a UNION qualified.
    Ptah compared the texts, so such a view was replaced with CREATE OR REPLACE VIEW on 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 refuses DROP TABLE of a table a change stream names in its FOR
    clause, and DROP COLUMN of a column one names in its column list, only
    when the statement runs, so ptah schema apply stopped PARTIAL with the
    statements before the drop applied. Before the first statement of a run, the
    provider now reads information_schema.change_stream_tables and
    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 table
    

    A stream FOR ALL names nothing, and a stream FOR t names 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 up runs each
    statement on its own, so the statements before the drop have run, and the
    revision row records the provider's reason instead of SQLSTATE 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-run and ptah migrations generate refuse 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 table
    

    A 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 new CHECK the table is
    left without it: check the rows before you narrow a CHECK, 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.

Changelog

  • aec594f Assert that a changed enum list replaces the column's CHECK (#32)
  • 79cccb3 Decide view queries Spanner rewrites under contract 25.37 (#30)
  • 6fb0224 Refuse at plan time a drop a change stream names (#33)
  • 41eff26 Refuse drops a change stream names before the first statement runs (#31)