IF Commons GitHub

sql objects

0048Active

0048-sql-objects · owner if · domain data

Requirements

FR-001checkpassing

Sequences, enumerated types, domains, schemas and extensions MUST be values that make idempotent DDL (made again, they change nothing) with quoted, case-styled names.

Enforced (check): .github: cd commons/data && bun run verify — suite/objects.test.ts: on PostgreSQL a sequence counts, an enumerated type refuses a value it does not have, a domain refuses what its rule refuses and a null where it is not null, an extension is made, and making them all again changes nothing; suite/objects.test.ts: on DuckDB a schema, a sequence and an enumerated type are made and made again, and a domain and an extension, which DuckDB does not have, are an error value that names them

Proved by: data/suite/objects.test.ts

Written in: data/sql/extensions/objects/mod.ts, data/sql/extensions/objects/objects.ts

Tests: passed: suite/objects.test.ts on PostgreSQL a sequence counts, an enumerated type refuses a value it does not have, a do; passed: suite/objects.test.ts on DuckDB a schema, a sequence and an enumerated type are made and made again, and a domai

FR-002checkpassing

On PostgreSQL the objects MUST do what they say: a sequence counts, an enumerated type and a domain refuse what they do not allow, an extension is made.

Enforced (check): .github: cd commons/data && bun run verify — suite/objects.test.ts: on PostgreSQL a sequence counts, an enumerated type refuses a value it does not have, a domain refuses what its rule refuses and a null where it is not null, an extension is made, and making them all again changes nothing

Proved by: data/suite/objects.test.ts

Written in: data/sql/extensions/objects/objects.ts

Tests: passed: suite/objects.test.ts on PostgreSQL a sequence counts, an enumerated type refuses a value it does not have, a do

FR-003checkpassing

Where a dialect has no such object it MUST be an error value that names it, and where a project carries them nothing MUST be written.

Enforced (check): .github: cd commons/data && bun run verify — suite/objects.test.ts: on DuckDB a schema, a sequence and an enumerated type are made and made again, and a domain and an extension, which DuckDB does not have, are an error value that names them; suite/objects.test.ts: SQLite has none of them: each is an error value that names it, and where the project carries them nothing is written

Proved by: data/suite/objects.test.ts

Written in: data/sql/extensions/objects/objects.ts

Tests: passed: suite/objects.test.ts on DuckDB a schema, a sequence and an enumerated type are made and made again, and a domai; passed: suite/objects.test.ts SQLite has none of them: each is an error value that names it, and where the project carri

FR-004checkpassing

An enumerated type MUST be made from a closed code list, and objects MUST come before the tables that use them.

Enforced (check): .github: cd commons/data && bun run verify — suite/objects.test.ts: an enumerated type can be made from a closed code list with its values written as the codes are, objects come before the tables, a name is quoted, and the objects are an extension of the engine

Proved by: data/suite/objects.test.ts

Written in: data/sql/extensions/objects/objects.ts

Tests: passed: suite/objects.test.ts an enumerated type can be made from a closed code list with its values written as the code

Out of scope

  • Objects of dialects that have none: they are an error value, not a silent omission.

Edge cases

  • A dialect without the feature, an empty list, or a name that needs quoting: each is an error value or is quoted, never a silent omission, per FR-001.

Assumptions

  • The engines of the tests are SQLite, DuckDB and PGlite (PostgreSQL), in process.

Open questions

  • None.

Key entities

  • Object - a sequence, an enumerated type, a domain, a schema or an extension, as a value that makes idempotent DDL.

Success criteria

SC-001success criterion

Each requirement above is proved by a test that runs on real engines, and bun run verify is green.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

Data, sql/extensions/objects/mod, sql/extensions/objects/objects

Titles, headings, exports, tables, columns and requirements. Esc closes.