Skip to main content

Module postgres

Module postgres 

Source

Structs§

PostgresAdapter
A Postgres storage adapter. Currently supports planning only. No live connection — SQL generation and planning from manifest.

Enums§

JsonParam
A typed wrapper around a JSON scalar that implements [postgres::types::ToSql] for INSERT/UPDATE parameters.

Constants§

INTROSPECT_COLUMNS_SQL
SQL to list columns for a given table. Use with parameter: table_name.
INTROSPECT_INDEXES_SQL
SQL to list indexes for a given table. Use with parameter: table_name.
INTROSPECT_TABLES_SQL
SQL to list user tables in the public schema.

Functions§

add_column_sql
Generate a Postgres ALTER TABLE ADD COLUMN statement. NOT NULL is omitted on ADD COLUMN to avoid requiring DEFAULT values. Required-ness is tracked in the manifest; enforcement deferred.
build_insert_sql
Build an INSERT SQL statement and collect typed parameter values. Returns (sql, params) where params[0] is the generated ID (always JsonParam::Text). Subsequent params carry the JSON-typed value so the postgres driver can bind them to typed columns (INTEGER / BOOLEAN / TIMESTAMPTZ / TEXT) and so JSON null reaches the database as SQL NULL — the previous string-collapsing path stored "" for nullable FKs and broke any non-text column.
build_update_sql
Build an UPDATE SQL statement and collect typed parameter values. Returns (sql, params) where params[0] is the row ID.
create_index_sql
Generate a Postgres CREATE INDEX statement.
create_table_sql
Generate a Postgres CREATE TABLE statement.
generate_id
Generate a lex-sortable, monotonic-ish unique ID.
json_value_to_string
Convert a JSON value to its string representation for use as a SQL parameter.
plan_from_snapshot
Plan from a snapshot (reuses the shared plan_from_snapshot). This allows Postgres to plan incrementally once introspection data is available.
plan_to_sql
Generate all SQL statements for a plan, in order. Useful for dry-run preview of what Postgres DDL would be executed.