PostgreSQL is a widely used open-source relational database system known for reliability, extensibility, and standards compliance. It stores structured data in tables and supports SQL for querying, transactions, and schema management.
With this integration, you can:
- Query data: Run SELECT statements to retrieve rows from a database
- Insert, update, and delete data: Write, modify, and remove rows in a table
- Execute raw SQL: Run arbitrary SQL statements directly against the database
- Introspect schemas: Retrieve table structures, columns, primary/foreign keys, and indexes
In Sim, the PostgreSQL integration allows your agents to connect to a PostgreSQL database and query, insert, update, delete, and execute raw SQL against it, as well as introspect the database schema to discover tables, columns, and relationships. This gives your agents the ability to read and write structured data as part of a workflow, and to understand a database's structure before generating or running queries against it.
Integrate PostgreSQL into the workflow. Can query, insert, update, delete, and execute raw SQL.
Execute a SELECT query on PostgreSQL database
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
query | string | Yes | SQL SELECT query to execute |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
rows | array | Array of rows returned from the query |
rowCount | number | Number of rows returned |
Insert data into PostgreSQL database
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
table | string | Yes | Table name to insert data into |
data | object | Yes | Data object to insert (key-value pairs) |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
rows | array | Inserted data (if RETURNING clause used) |
rowCount | number | Number of rows inserted |
Update data in PostgreSQL database
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
table | string | Yes | Table name to update data in |
data | object | Yes | Data object with fields to update (key-value pairs) |
where | string | Yes | WHERE clause condition (without WHERE keyword) |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
rows | array | Updated data (if RETURNING clause used) |
rowCount | number | Number of rows updated |
Delete data from PostgreSQL database
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
table | string | Yes | Table name to delete data from |
where | string | Yes | WHERE clause condition (without WHERE keyword) |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
rows | array | Deleted data (if RETURNING clause used) |
rowCount | number | Number of rows deleted |
Execute raw SQL query on PostgreSQL database
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
query | string | Yes | Raw SQL query to execute |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
rows | array | Array of rows returned from the query |
rowCount | number | Number of rows affected |
Introspect PostgreSQL database schema to retrieve table structures, columns, and relationships
| Parameter | Type | Required | Description |
|---|
host | string | Yes | PostgreSQL server hostname or IP address |
port | number | Yes | PostgreSQL server port (default: 5432) |
database | string | Yes | Database name to connect to |
username | string | Yes | Database username |
password | string | Yes | Database password |
ssl | string | No | SSL connection mode (disabled, required, preferred) |
schema | string | No | Schema to introspect (default: public) |
| Parameter | Type | Description |
|---|
message | string | Operation status message |
tables | array | Array of table schemas with columns, keys, and indexes |
↳ name | string | Table name |
↳ schema | string | Schema name (e.g., public) |
↳ columns | array | Table columns |
↳ name | string | Column name |
↳ type | string | Data type (e.g., integer, varchar, timestamp) |
↳ nullable | boolean | Whether the column allows NULL values |
↳ default | string | Default value expression |
↳ isPrimaryKey | boolean | Whether the column is part of the primary key |
↳ isForeignKey | boolean | Whether the column is a foreign key |
↳ references | object | Foreign key reference information |
↳ table | string | Referenced table name |
↳ column | string | Referenced column name |
↳ primaryKey | array | Primary key column names |
↳ foreignKeys | array | Foreign key constraints |
↳ column | string | Local column name |
↳ referencesTable | string | Referenced table name |
↳ referencesColumn | string | Referenced column name |
↳ indexes | array | Table indexes |
↳ name | string | Index name |
↳ columns | array | Columns included in the index |
↳ unique | boolean | Whether the index enforces uniqueness |
schemas | array | List of available schemas in the database |