Skip to main content

Module postgres

Module postgres 

Source
Expand description

PostgreSQL provider — database schema introspection via psql.

Extracts table/column definitions from information_schema to make database structure available as context. Uses psql CLI to avoid adding a native PG driver dependency.

Configuration via environment variables:

  • DATABASE_URL: Full connection string (e.g., “postgres://user:pass@host/db”)
  • Or individual: PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD

Structs§

PostgresProvider

Functions§

run_sql_file
Run the SQL file at sql_path against url with psql: no .psqlrc, no password prompt, stopping at the first error, unaligned tuples only. Each of variables (name=value) is passed as one -v argument and is referenced in the SQL as :'name', quoted by psql. The connection travels only in PG* variables of the child; output is bounded and database diagnostics are withheld (run_psql).