Skip to content

v0.3.1

Latest

Choose a tag to compare

@Kiran01bm Kiran01bm released this 07 Sep 06:20
· 2 commits to main since this release
v0.3.1
7004102

A patch release carrying the two library additions that landed just after the v0.3.0 cut, giving orchestrators two typed signals around the create path: a closed vocabulary for why a desired statement's shape was refused, and a catalog read of the constraint-index and sequence names a table actually ended up owning. No format_version, outcome-code or refusal-reason vocabulary changes; the CLI's behaviour is unchanged.

Highlights

Create-shape refusals carry a typed cause

  • executor.CreateShapeCause — the create path's shape refusals (PARTITION OF, INHERITS, LIKE, OF type, IF NOT EXISTS, CONCURRENTLY on a table born this run, a duplicate relation name, a multi-operation statement, an unsupported kind) now carry one of nine flat kebab-case causes instead of only prose, so a consumer branches on the cause the way it branches on outcome codes. CreateShapeCauses() enumerates the closed set; Description() is the single owner of each human sentence; *CreateShapeError{Cause, Name} unwraps to the sentinel the cause belongs to, so existing errors.Is callers and the OutcomeCode mapping are untouched; CreateShapeCauseOf(err) reads the cause through wrappers, including a SequenceStepError. A cause added without a Description() or Unwrap() arm fails the suite rather than rendering "unknown create-shape refusal" at runtime. (#82)

Read back what a table owns

  • preflight.LookupOwnedRelationNames(ctx, pool, schema, table) — one catalog read returning the constraint-index names (pg_constraint, contype p/u/x; a foreign key's borrowed index on the referenced table is excluded) and column-owned sequence names (pg_depend deptype a/i, relkind S) a table owns, sorted and duplicate-free, whether the server invented the name or the desired file stated it. PostgreSQL never raises 42P07/42710 for an implicit name taken inside the absence proof's time-of-check window — it silently suffixes (t_pkey1, t_id_seq1) — and this read is what lets a caller detect that after the CREATE TABLE step. Schema is required; a missing relation is ErrTableNotFound, a non-table at the name is ErrNotTable. The create path does not yet run the comparison itself. (#83)

Upgrade notes

  • Library API additions, no removals. New in executor: CreateShapeCause and its nine constants, CreateShapeCauses(), CreateShapeCause.Description(), *CreateShapeError (Unwrap() returns the existing sentinel), CreateShapeCauseOf(err). New in preflight: OwnedRelationNames{ConstraintIndexes, Sequences}, LookupOwnedRelationNames, ErrTableNotFound, ErrNotTable. No signature changed.
  • Six create-shape sentences lost their prefix. The INHERITS, LIKE, OF, CONCURRENTLY, multiple-operations and unsupported-kind refusals no longer start with statement is not a shape the create path can run:; every renderer already says the create path refuses the statement. PARTITION OF, IF NOT EXISTS and duplicate-name text is byte-identical. A consumer matching refusal text should switch to CreateShapeCauseOf; errors.Is against ErrUnsupportedCreateStep, ErrPartitionOfUnsupported, ErrIfNotExistsUnsupported and ErrDuplicateCreateName keeps working.
  • No format_version, outcome-code or refusal-reason vocabulary change. Plan and progress reports are byte-compatible with v0.3.0; fingerprints are unchanged.

Docs

Contributors

Full changelog: v0.3.0...v0.3.1