IF Commons GitHub

sql plpgsql

0050Active

0050-sql-plpgsql · owner if · domain data

Requirements

FR-001checkpassing

A block of typed statements MUST be the body of a routine made with the names the case style writes.

Enforced (check): .github: cd commons/data && bun run verify — suite/plpgsql.test.ts: a block of typed statements is the body of a routine that is made with the names the case style writes and runs on PostgreSQL: loops, conditions, a handler for a named condition, an error with a state, and rows returned

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

Written in: data/sql/extensions/routines/plpgsql.ts

Tests: passed: suite/plpgsql.test.ts a block of typed statements is the body of a routine that is made with the names the case

FR-002checkpassing

It MUST run on PostgreSQL: loops, conditions, handlers, errors with a state, rows returned.

Enforced (check): .github: cd commons/data && bun run verify — suite/plpgsql.test.ts: a block of typed statements is the body of a routine that is made with the names the case style writes and runs on PostgreSQL: loops, conditions, a handler for a named condition, an error with a state, and rows returned

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

Written in: data/sql/extensions/routines/plpgsql.ts

Tests: passed: suite/plpgsql.test.ts a block of typed statements is the body of a routine that is made with the names the case

FR-003checkpassing

What is wrong with a block MUST be an error value before anything is made.

Enforced (check): .github: cd commons/data && bun run verify — suite/plpgsql.test.ts: what is wrong with a block is an error as a value before anything is made: a variable that was not declared or is declared twice, a function that can end without returning, a value returned from a procedure and none from a function, a state that is not one, and a table or column the schema lacks

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

Written in: data/sql/extensions/routines/plpgsql.ts

Tests: passed: suite/plpgsql.test.ts what is wrong with a block is an error as a value before anything is made: a variable that

Out of scope

  • Other procedural languages.

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

  • Block - a typed body of statements for a routine, checked before anything is made.

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/routines/plpgsql

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