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 (opens in a new tab) 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 (opens in a new tab).
For connecting to individual PostgreSQL tables, see the PostgreSQL Data Connector documentation (opens in a new tab).
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 (opens in a new tab). 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.
:::warning
BASE TABLE and VIEW relations. Materialized views and foreign tables are not currently discovered and will not appear in the catalog (#11725 (opens in a new tab)).include filters tables, not schemas. The include patterns are matched against schema.table. All non-system schemas are still enumerated as (possibly empty) schemas even when no tables match.unsupported_type_action behavior available on individual PostgreSQL datasets is not applied on the catalog path (#11728 (opens in a new tab)).information_schema.tables and information_schema.schemata). Schemas and tables consumed from a datashare, and external schemas and tables (Redshift Spectrum), are absent from the local catalog — Redshift exposes them only through its svv_all_schemas / svv_all_tables views, which the Catalog Connector does not query. Those relations do not appear in the catalog; register them as individual datasets with the Redshift Data Connector (opens in a new tab) instead (#12109 (opens in a new tab)).pg_catalog coverage is partial and it does not enforce foreign keys, so table/column comment and foreign-key metadata are often unavailable. Tables present in the local catalog are still registered.:::
There is a cookbook recipe (opens in a new tab) demonstrating the PostgreSQL Catalog Connector with the TPC-H dataset.
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 (opens in a new tab). Additionally, learn how to use referenced secrets in component parameters by visiting the using referenced secrets guide (opens in a new tab).