title: 'PostgreSQL Catalog Connector' sidebar_label: 'PostgreSQL' description: 'Connect to a PostgreSQL database as a catalog provider for federated SQL query.' sidebar_position: 8 pagination_prev: null pagination_next: null tags:
Connect to a PostgreSQL database as a catalog provider for federated SQL query. The PostgreSQL Catalog Connector automatically discovers schemas and tables within a PostgreSQL database and makes them available for querying in Spice. This connector also works with PostgreSQL-compatible databases such as Amazon Redshift.
For connecting to individual PostgreSQL tables, see the PostgreSQL Data Connector documentation.
fromThe from field specifies the catalog provider. For PostgreSQL, use pg.
nameThe name field specifies the name of the catalog in Spice. Tables from the PostgreSQL database will be available under this catalog name. The schema hierarchy of the PostgreSQL database is preserved in Spice.
includeUse the include field to specify which tables to include from the catalog. The include field supports glob patterns to match multiple tables. For example, *.my_table_name would include all tables with the name my_table_name from any schema. Multiple include patterns are OR'ed together.
paramsConnection can be configured using a connection string or individual parameters.
| Parameter Name | Description |
|---|---|
pg_connection_string | A PostgreSQL connection string. E.g. postgresql://user:password@host:port/dbname. |
| Parameter Name | Description |
|---|---|
pg_host | The PostgreSQL host address. |
pg_port | The PostgreSQL port number. |
pg_db | The PostgreSQL database name. |
pg_user | The PostgreSQL username for authentication. |
pg_pass | The PostgreSQL password for authentication. |
pg_sslmode | The SSL mode for the connection (e.g. require, prefer, disable). |
pg_sslrootcert | Path to the SSL root certificate file, or inline PEM content. |
The PostgreSQL Catalog Connector can also be used with Amazon Redshift:
The PostgreSQL Catalog Connector automatically discovers foreign key relationships by querying information_schema.referential_constraints and key_column_usage during catalog refresh. Discovered FK metadata is attached to each table's Arrow schema and surfaces through:
table_schema tool — agents can use FK relationships to infer join paths between tablesGetTables — programmatic clients receive FK metadata in the schema responseNo configuration is required. If FK discovery fails for a schema (e.g., due to insufficient permissions on information_schema), tables are still registered without FK metadata and a warning is logged.
Spice integrates with multiple secret stores to help manage sensitive data securely. For detailed information on supported secret stores, refer to the secret stores documentation. Additionally, learn how to use referenced secrets in component parameters by visiting the using referenced secrets guide.