Repository navigation
v0.23.0
Spanner moves to its provider
Ptah no longer builds in a Spanner engine. Spanner's PostgreSQL interface is
served by the optional Spanner provider, released separately as
ptah-spanner-plugin v0.1.0.
Install it with ptah providers install spanner. A command that selects Spanner
without the provider reports provider_missing with the install command and
the setup page. A server behind a postgres:// URL whose version banner names
Spanner is refused with provider_engine_identified before anything is read, so
Ptah never treats a Spanner server as PostgreSQL. Pre-v1, so no compatibility
with the built-in engine is owed: the public packages under dialect/spanner
and the SpannerPostgres preset are gone, and the provider documents what
Spanner does in Ptah under Extend, Providers, Spanner on docs.ptah.run.
Known gaps until the next Spanner provider release: an enum="..." field on a
Spanner table is refused until the provider states how it builds an enum column
(contract 25.31), and ptah sql lint --dialect spanner does not report CAP001
until the provider states its offline capabilities
(stokaro/ptah-spanner-plugin#16).
The provider plans foreign keys and CHECKs, row deletion policies, views and
sequences, keeps migration history and its lock, cleans dev databases and lints
migrations. Several defects of the built-in engine do not carry over: a CHECK
with a numeric literal converges, a CHECK replacement no longer renders
DROP CONSTRAINT IF EXISTS, a primary key change is refused instead of failing
at apply, and the down file of a schema with foreign keys drops the keys before
the tables.
Provider contract 25.28 to 25.32 and a conformance suite
- Contract 25.28: observed constraints, constraint changes of a table a
provider owns, CHECK equivalence decided by the provider, and the NULLS order
of every index key. - Contract 25.29: namespaces as observed and declared objects, SQL table
clauses an engine claims, a reserved purpose for the seed ledger, and
provider index predicates. - Contract 25.30: a release line of an engine linked into its provider names
its linked version as evidence, and the provider's working directory is the
host's invocation directory. - Contract 25.31: an engine states how it builds an enum column, and a provider
reports a UNIQUE constraint over several columns. - Contract 25.32: a column's collation is compared apart from its type, a view
carries its check option level, the host hands a provider every declared
relation with its kind, and a planning service owns tables without a
placeholder setting. The host drops removed tables in the order their read
foreign keys require. provider-sdk/conformanceandptah-provider-conformancecheck a provider
against the contract as a strict host: handshake, description and
negotiation, every RPC, offline calls, and a live part against a database.
The YDB provider and the minimal provider example run it in CI.- The host predicts a provider table's foreign keys for a rollback plan, so
ptah migrations generatewrites down files for a provider schema with
foreign keys.
The SDK releases are provider-sdk/v0.25.0 (25.28), v0.26.0 (25.28 with the
conformance suite), v0.27.0 (25.29), v0.28.0 (25.30), v0.29.0 (25.31) and v0.30.0 (25.32).
The contract freezes together with Ptah 1.0 at major 25 (ADR 0102).
MySQL and MariaDB foreign keys
Plans that move, remove or add foreign keys next to the indexes they stand on
no longer stop halfway. Measured on MySQL 8.4, MySQL 26.10 and MariaDB 12.3:
an index the server built for a key now leaves in the statement that adds the
index replacing it, a kept key's index takeover is written once, every key the
plan changes on a table is dropped before its index is rebuilt, and rollbacks
return the table to its built state. The same holds when a UNIQUE constraint,
a primary key or a column's own UNIQUE takes over such an index.
Other fixes
ptah migrations generateof a column drop works on a provider engine: the
rollback restores the column with its declared settings, where it handed the
provider the values a read returned and failed.- A generated down file that has nothing to undo, such as the rollback of a
YDB secret rotation, carries-- +ptah empty_rollbackwith its notes, so
migrations downruns it instead of refusing an empty file. - A declared schema the target cannot receive is refused by name, where a
provider without namespaces dropped it without a word. - The SQL schema reader no longer assumes facts of the deleted Spanner engine
for a provider engine: columns named after index keywords are columns, and a
drop of a view or table that another view reads is refused, as the server
refuses it.DROP VIEW IF EXISTSof a table is still refused
(#5701). - A view's
WITH CHECK OPTIONin a SQL schema file is read as the view's check
option instead of staying inside its body. - A CockroachDB key removal and an enum rebuild no longer render
IF EXISTS
on the drops behind them. - SQL schema parse errors report a line and column;
schema applyreports
where it stopped and a lost migration log entry in its JSON document. - A refused Git reference and a database address never repeat a credential.
- MySQL and MariaDB reads of objects the account cannot see are refused with an
error kind, and migration times read withoutparseTime. - A change that narrows a temporal column or lowers a type's capacity is rated
destructive; SQL Server column type changes report DS103.
The YDB provider documentation on docs.ptah.run follows ptah-ydb-plugin v0.4.1.
Security
These defects exposed secrets in v0.22.1 and earlier. Upgrade if a schema can come from someone else, or if your logs are shared.
- A schema could read a file outside the project. A
datablock'sfilewas read with no boundary byschema drift,schema push,migrations data, andptah-compat schema planandschema apply. Compat printed the values in anINSERTand applied them, andschema pushuploaded them. Every read of a row file is now bounded by the project, andptah-compatcounts the working directory and theatlas.hcldirectory as the project (#5560). A row file outside the working directory is refused even beside the schema file, when the command runs from another directory. - A password could reach the output. A MySQL DSN printed its password whole on ordinary runs, and a URL parse error could quote part of a password. The display now hides it in every address form, and errors from opening a connection repeat none of it. An address with no
@after the password still reads as a valid URL, so that text is printed (#5659). A refused Git reference no longer prints its credential (#5662).
Spanner moves to its provider
Ptah no longer builds in a Spanner engine. Spanner's PostgreSQL interface is served by the optional Spanner provider, released separately as ptah-spanner-plugin v0.1.0 (#5657). Install it with ptah providers install spanner. A command that selects Spanner without the provider reports provider_missing with the install command and the setup page. A server behind a postgres:// URL whose version banner names Spanner is refused with provider_engine_identified before anything is read, so Ptah never treats a Spanner server as PostgreSQL. Pre-v1, so no compatibility with the built-in engine is owed: the public packages under dialect/spanner, platform.Spanner and the SpannerPostgres preset are gone, and the provider documents what Spanner does in Ptah under Extend, Providers, Spanner on docs.ptah.run.
Known gaps until the next Spanner provider release: an enum="..." field on a Spanner table is refused until the provider states how it builds an enum column (contract 25.31), and ptah sql lint --dialect spanner does not report CAP001 until the provider states its offline capabilities (stokaro/ptah-spanner-plugin#16).
The provider plans foreign keys and CHECKs, row deletion policies, views and sequences, keeps migration history and its lock, cleans dev databases and lints migrations. Several defects of the built-in engine do not carry over: a CHECK with a numeric literal converges, a CHECK replacement no longer renders DROP CONSTRAINT IF EXISTS, a primary key change is refused instead of failing at apply, and the down file of a schema with foreign keys drops the keys before the tables.
What an existing user will notice
- MySQL and MariaDB accounts with narrow grants now stop.
schema diff,compare,drift,inspect,planandapplyrefuse at exit 2 when the account cannot see what the read depends on, naming the missing privilege, where they readSchemas are synced(#5497, #5545). The JSON carrieserror.kind: permission_deniedandmissing_privileges(#5550). An account with onlySELECT, CREATE, ALTER, DROP, INDEX, REFERENCESon the database is refused for lack ofTRIGGERand the globalSHOW_ROUTINE.--exclude '*[type=trigger]'relieves a kind, andschema driftandschema comparenow take--excludetoo (#5666). A server that does not answerSHOW GRANTSfails the read (#5600). - New plans on columns that read synced. A type with a size on one side now plans a change where the two differ:
numericandnumeric(10,2),decimalanddecimal(10,2),nvarchar(max)andnvarchar(50), OracleTIMESTAMP(n)(#5567). Review the first plan after upgrading. - More plans are rated destructive. A narrowing type change is destructive on every engine, including temporal precision,
longtexttotext,double precisiontorealandbiginttoint(#5546, #5573). So isDROP IDENTITY.schema apply's prompt shows the rating (#5651). - Partitions move instead of being refused. A partition with another bound or another parent, and a table that turns from a partition into an ordinary table or back, plan
ALTER TABLE ... DETACH PARTITIONandATTACH PARTITIONin the plan's transaction, where a manual cutover was required. Each statement is rated a warning: both lock the parent, andATTACHreads the partition's rows to check the bound. A rollback moves the table back (#5731). - The owner's privileges stay out of a PostgreSQL plan. A default ACL and a written one read alike, so
schema diffno longer printsGRANTorREVOKEon a table's owner. TheREVOKEform left an owner locked out of its own table. A rebuilt view gives its old owner noGRANT(#5528). - A waiting plan may be replaced once. A plan's fingerprint covers the role memberships it depends on and the role that reads, so an unrelated
GRANTno longer replaces it. A plan made before this is replaced once on a server with memberships outside its scope, and a plan applied as another role holding a group the plan does not cover is refused as stale (#5542). - Reports say what really happened.
migrations upon CockroachDB and YugabyteDB reportspartialorunknownwith what stayed, where it readfailedwith 0 applied (#5569).schema apply --jsonreportsrefusedwithtransaction-unavailablewhen a provider cannot open a transaction, andfailedwhere nothing left the host (#5551). - A rollback with nothing in it is refused.
migrations downstops on a down file with no statements, because the version would move and the change would stay. Write the rollback, or state that it has none with-- +ptah empty_rollbackat the top of the file (#5670). A generated down file that has nothing to undo carries that line with its notes (#5727). schema apply --dry-runrefuses what the real run refuses, at exit 2, where it reporteddry-runat exit 0 (#5669).WITH LOCAL CHECK OPTIONin a SQL schema file is refused by name, because the model cannot hold that level yet (#5647).WITH CHECK OPTIONis read as the view's option and stops replacing the view on every apply (#5654).- PostgreSQL 18 NOT NULL names converge in one plan. A declared name on an existing column is written as
ADD CONSTRAINT "nn" NOT NULL "a", where a second plan renamed it (#5649). A renamed primary key column keeps its name (#5664), and a renamed column next to a new nullable one under its old name no longer collides (#5688). Toward a PostgreSQL 17 target, the name the server gives is left out, where it was refused; any other name is still refused, now also on a primary key column (#5644, #5664).ptah-compatwrites these statements under strict mode too, where the community binary writesSET NOT NULL: keeping those bytes would need a second plan. - A provider that starts too slowly is named. The refusal says which engine, provider and executable it was, the ten-second timeout and how long it ran, with the code
provider_start_timeout(#5704).
Provider contract 25.28 to 25.32 and a conformance suite
- Contract 25.28: observed constraints, constraint changes of a table a provider owns, CHECK equivalence decided by the provider, and the NULLS order of every index key.
- Contract 25.29: namespaces as observed and declared objects, SQL table clauses an engine claims, a reserved purpose for the seed ledger, and provider index predicates.
- Contract 25.30: a release line of an engine linked into its provider names its linked version as evidence, and the provider's working directory is the host's invocation directory.
- Contract 25.31: an engine states how it builds an enum column, and a provider reports a UNIQUE constraint over several columns.
- Contract 25.32: a column's collation is compared apart from its type, a view carries its check option level, the host hands a provider every declared relation with its kind, and a planning service owns tables without a placeholder setting. The host drops removed tables in the order their read foreign keys require.
provider-sdk/conformanceandptah-provider-conformancecheck a provider against the contract as a strict host: handshake, description and negotiation, every RPC, offline calls, and a live part against a database. The YDB provider and the minimal provider example run it in CI.- The host predicts a provider table's foreign keys for a rollback plan, so
ptah migrations generatewrites down files for a provider schema with foreign keys.
The SDK releases are provider-sdk/v0.25.0 (25.28), v0.26.0 (25.28 with the conformance suite), v0.27.0 (25.29), v0.28.0 (25.30), v0.29.0 (25.31) and v0.30.0 (25.32). The contract freezes together with Ptah 1.0 at major 25 (ADR 0102).
MySQL and MariaDB foreign keys
Plans that move, remove or add foreign keys next to the indexes they stand on no longer stop halfway. Measured on MySQL 8.4, MySQL 26.10 and MariaDB 12.3: an index the server built for a key now leaves in the statement that adds the index replacing it, a kept key's index takeover is written once, every key the plan changes on a table is dropped before its index is rebuilt, and rollbacks return the table to its built state. The same holds when a UNIQUE constraint, a primary key or a column's own UNIQUE takes over such an index (#5646, #5695).
New
- A
pg_dumpof partitioned tables reads. The reader takesALTER TABLE ... ATTACH PARTITION,ALTER INDEX ... ATTACH PARTITION,CREATE INDEX ... ON ONLY, and the\restrictlines recentpg_dumpreleases write, and reads the dump as the declarationPARTITION OFmakes (#5722). YugabyteDB readsALTER INDEXas PostgreSQL does (#5728). CREATE TABLE ... PARTITION OFin SQL schema files, read, compared and planned on PostgreSQL and YugabyteDB (#5529).migrations down --jsonprints the run documentmigrations up --jsonprints, withrolled_back. It needs--confirmor--dry-run(#5708).schema driftandschema comparetake--excludeand--include, with the meaning they have onschema diff(#5666).schema apply --jsoncarriesfailurewith the statement, its position, SQLSTATE and server error number, and no text (#5562).migrations up --jsoncarriesmigration_log, naming lost log entries (#5541).schema planandschema applyreport refusals by code:view-security-option,dependent-object,declaration-refused(#5549, #5564).schema pull --skip-parsewrites an OCI artifact without parsing it, and every integrity check still runs (#5554).schema driftgainsnot_compared, because MySQL and MariaDB events are not modeled (#5552, #5640).- SQL parse errors name a line and column, not
at position N(#5553), and so does a refusal of what a statement declares, which names where the statement begins (#5711).sql lintreadsDROP VIEW,TRUNCATEand other statements (#5580), andmigrations lintreports what it could not read asAC102(#5563). migrations log,migrations tagandstatusread MySQL times withoutparseTime(#5547).- A comment above
ADD COLUMN ... NOT NULLwith no default says it fails on a table with rows (#5526).
Fixed
- Plans no longer change a column declared by a portable name on every run, where the server reads the name back under another:
serialon YugabyteDB,blobandjsonon CockroachDB,jsonon MariaDB,boolon Oracle, andboolean,byteaandserialon SQLite. Most of these plans were rated destructive, so they stopped--check-destructive(#5676). SQL Server compares a portable name with the type it writes (#5652). - A removed table is dropped after the removed tables that reference it (#5707).
ptah migrations generateof a column drop works on a provider engine: the rollback restores the column with its declared settings (#5720).- A declared schema the target cannot receive is refused by name, where a provider without namespaces dropped it without a word (#5719).
- The SQL schema reader no longer assumes facts of the deleted Spanner engine for a provider engine: columns named after index keywords are columns, and a drop of a view or table that another view reads is refused, as the server refuses it.
DROP VIEW IF EXISTSof a table is still refused (#5701). - A seed run followed by
schema applyno longer plansDROP TABLE "schema_seeds"(#5641). - A CockroachDB key removal and an enum rebuild no longer render
IF EXISTSon the drops behind them (#5530, #5615). - A SQL Server column type change reports as
DS103(#5575).
Known issues
- A partition move that takes a table out of its parent is rated a warning, though the parent stops returning the partition's rows. Master rates the detachment destructive (#5739).
nchar(5)plans a change on every run on PostgreSQL, YugabyteDB, MySQL and MariaDB, rated safe (#5681).- A YugabyteDB identity column plans
DROP NOT NULLagainst its own declaration (#5684).
Providers
ptah providers check reports compatible for ptah-ydb-plugin v0.4.1 and ptah-spanner-plugin v0.1.0 on this release, without a database. The YDB provider documentation on docs.ptah.run follows ptah-ydb-plugin v0.4.1.
Changelog
- 5f73a49 Add a guide to writing, testing and releasing a provider (#5531)
- a3975b9 Add contract 25.28: observed constraints, constraint changes, CHECK equivalence and index NULLS order (#5558)
- dd7fdae Add contract 25.29: namespaces, SQL table clauses, the seed ledger and index predicates (#5582)
- 138802e Add contract 25.30: linked release lines and the provider's working directory (#5643)
- a0dd6e4 Add contract 25.31: enum columns and observed UNIQUE constraints (#5687)
- 5bbf5b7 Add contract 25.32: collations, view check options, relations, table owners (#5709)
- 9817c36 Adopt contract 25.28 on the host: constraints, CHECK equivalence and index NULLS order (#5561)
- 617cb63 Adopt contract 25.29 on the host: namespaces, table clauses, the seed ledger and index predicates (#5641)
- 5938bde Adopt contract 25.30 on the host: linked release lines and the provider working directory (#5645)
- be30b2c Adopt contract 25.31 on the host: enum columns and UNIQUE constraints (#5697)
- c0e5c5f Adopt contract 25.32 on the host: collations, check options, relations, table owners (#5718)
- c6cf00e Assert the Spanner banner refusal with qt.ErrorAs (#5673)
- 3d0a6b5 Assert the ptah mcp refusal for an engine only a provider serves (#5717)
- 9971329 Bound every read of a declared row file by the project (#5560)
- 4a71671 Check a provider against the contract with an SDK conformance suite (#5555)
- 46d1e81 Check providers and suites across SDK releases with the conformance suite (#5698)
- a4068a7 Compare a column type's size when one side leaves it out (#5567)
- d7ac995 Compare a portable type name with the type it writes on SQL Server (#5652)
- 223901b Compare what a server builds from a portable name on the other engines (#5676)
- a02d8bb Count a table owner wherever a service with a parent kind counts (#5721)
- 9b80293 Delete the built-in Spanner engine; Spanner is served by its provider (#5657)
- 392e87e Drop a foreign key's built index with any key that takes it over (#5695)
- cd04901 Drop a removed table after the removed tables that reference it (#5707)
- 9911bf2 Fix two integration tests the Spanner removal left stale (#5703)
- 4b64443 Freeze the provider contract with Ptah 1.0 at major 25 (ADR 0102) (#5702)
- 48e25a9 Give a refused MySQL or MariaDB read of the target an error kind (#5550)
- 31a08ba Give schema drift and schema compare the selectors schema diff takes (#5666)
- f5d249e Give the SDK README sections for release lines, lint and table policies (#5556)
- 4c7d7d4 Hold a NOT NULL name until the column gives it up (#5688)
- 49e1d61 Hold the provider foreign-key projection to a test matrix (#5642)
- 8b54dfe Import the DuckDB provider's pages from its v0.1.0 release (#5706)
- 7c14c1b Import the Spanner provider's pages from its v0.1.0 release (#5655)
- 5d92266 Import the YDB provider's pages from its v0.4.0 release (#5527)
- aa2ed60 Import the YDB provider's pages from its v0.4.1 release (#5572)
- 4f76b45 Keep a NOT NULL name a primary key column holds (#5664)
- cbb1034 Keep a credential out of a refused Git reference (#5662)
- 7ff1e25 Leave IF EXISTS off the drops behind a CockroachDB key removal (#5615)
- 909c800 Leave IF EXISTS off the drops behind an enum rebuild (#5530)
- 54aae35 Leave the server's NOT NULL name out where the target keeps none (#5644)
- 7d6cc89 Let schema pull leave an artifact unparsed (#5554)
- 0c143d8 Let the conformance lock check contend from the provider's own process (#5705)
- bd20a13 Mark a generated down file that runs only notes as an empty rollback (#5727)
- ed11ea5 Name a NOT NULL in the statement that adds it (#5649)
- 12ea0d6 Name a position in the SQL schema refusals that had none (#5711)
- a3ad0f0 Name a provider's dev database by its session, not a built-in descriptor (#5565)
- 0829f9a Name no dialect in the migrator's transaction preflight (#5568)
- 4159a48 Name the provider and the elapsed time when a startup times out (#5704)
- 62c4979 Order MySQL plans around the indexes foreign keys stand on (#5646)
- 4bbe57b Pin the minimal provider example to provider-sdk v0.26.0 (#5581)
- b875005 Pin the provider SDK at provider-sdk/v0.28.0 (#5656)
- 4e69ec8 Pin the provider SDK at provider-sdk/v0.29.0 (#5699)
- f47b2bf Pin the provider SDK at provider-sdk/v0.30.0 (#5732)
- 9ab034c Plan a partition's move to another bound or parent (#5731)
- de0c5fb Plan constraints of created tables and render schemas through a table owner (#5559)
- 2e3781d Plan nothing for a column declared by the word that built it (#5634)
- 4e04a62 Predict a provider table's foreign keys for a rollback plan (#5585)
- 0843c55 Print the run document from migrations down --json (#5708)
- 5a136c6 Propose the v1 freeze of the provider contract (ADR 0102) (#5689)
- 275ca7b Rate a change that narrows a temporal column as destructive (#5546)
- 6f9c76c Rate a change to a lower type capacity as a narrowing (#5573)
- 4205956 Read ALTER INDEX on YugabyteDB as PostgreSQL does (#5728)
- eccb59f Read DROP VIEW, TRUNCATE and the statements servers take on each dialect (#5580)
- 7659691 Read a pg_dump of partitioned tables as their declaration (#5722)
- 984d68a Read a view's check option out of its SQL body (#5654)
- 786c739 Read a wildcard grant as the server does in the transaction preflight (#5566)
- b2b7eba Read migration times from a MySQL URL without parseTime (#5547)
- 523f72e Read provider engine documents without the deleted Spanner facts (#5730)
- fd1a2d7 Read what an object's owner holds apart from its grants (#5528)
- 0317051 Read, compare and plan CREATE TABLE ... PARTITION OF in a SQL schema (#5529)
- 617f35e Record the fixture's startup delay as a non-boolean variable (#5710)
- ca306f8 Refuse a MySQL or MariaDB read of what the account cannot see (#5545)
- 61c09c4 Refuse a declared schema an engine without namespaces cannot hold (#5719)
- 432f567 Refuse a rollback through a down file with no statements (#5670)
- c6b5665 Refuse under --dry-run what a real schema apply refuses (#5669)
- 80073b7 Remove an empty x.db a commit left at the repository root (#5583)
- ba558ba Report SQL Server column type changes as DS103 (#5575)
- 9647ecf Report a declaration the comparison refuses by its code (#5564)
- ec91c3e Report a line and column in SQL schema parse errors (#5553)
- f3fde4a Report a lost migration log entry in the run document (#5541)
- d59a3b6 Report a schema apply as dispatched only when a statement leaves (#5551)
- 84e5669 Report a statement migration lint could not read (#5563)
- e6a4bc3 Report a view security refusal in schema plan by its code (#5549)
- 6036a1a Report what stayed after a rollback on CockroachDB and YugabyteDB (#5569)
- ee5dfa3 Report where a schema apply stopped in its JSON document (#5562)
- 91c92ab Restore a dropped column with its declared settings in the rollback (#5720)
- 63a4ee9 Run the SDK conformance suite in the minimal provider example (#5557)
- 3fd8242 Say in a comment that ADD COLUMN NOT NULL fails on a table with rows (#5526)
- bc55a18 Say what schema drift did not compare on MySQL and MariaDB (#5552)
- 3d68720 Scope a plan's source fingerprint to the role memberships it depends on (#5542)
- 1532c10 Show the plan's risk rating in schema apply's prompt (#5651)
- 92fdae8 Stop shadowing the engine import in a providerpublished test (#5685)
- 05e60af Sync the docs lock file and the schema stats sample with master (#5540)
- b8f9f18 Update aws-sdk-go-v2 monorepo (#5544)
- 5d548b9 Update dependency @astrojs/starlight to v0.42.10 (#5532)
- dc75aed Update golang.org/x/exp digest to 47ce03d (#5543)
- ddd6c25 Update golang.org/x/tools digest to 4f7264d (#5570)
- 03ae809 Update module github.com/zclconf/go-cty to v1.20.0 (#5548)
- ca9c618 Update module modernc.org/sqlite to v1.62.0 (#5696)
- 0038417 Update tailwindcss monorepo to v4.3.5 (#5524)
- 667abdd Warn about an event only on a verb that saw one (#5640)
- 8e6363f Write a kept key's index takeover once for keys named after its indexes (#5587)
- 7654dad Write no guard after an enum rebuild on ptah-compat too (#5584)
- e66890a fix: never repeat a password an address holds (#5659)