Skip to main content

Module render

Module render 

Source
Expand description

IR → SQL emitter.

Produces source-style CREATE statements for each Catalog object. Used by pgevolve dump and by future regression-capture tooling.

§Output contract

  • Schemas first, then tables (with their inline constraints, excluding FKs), then FK ALTER TABLE ... ADD CONSTRAINT statements (to handle FK cycles), then standalone indexes, then sequences.
  • Output is deterministic: for equal Catalog inputs, byte-identical SQL is produced. Objects are emitted in their iteration order (callers wanting canonical sort should call Catalog::canonicalize first).
  • Comments are emitted as COMMENT ON ... statements immediately after the object they describe.

§v0.1 limitations

  • Views / materialized views / functions / triggers are not emitted (they are not modelled in the v0.1 IR).
  • The output does NOT include pgevolve source directives (e.g. -- pgevolve: intent = ...), so a directory written by pgevolve dump cannot be fed directly to pgevolve lint or parse_directory without first adding those directives. Users running pgevolve init against the dump output should add directives manually, or use a future pgevolve annotate helper.

Modules§

index
Index renderer.
schema
Schema renderer.
sequence
Sequence renderer.
table
Table renderer.
view
View and materialized-view renderer.

Functions§

render_catalog
Render an entire Catalog as a single SQL string with one CREATE statement per object, in dependency-correct order.