PostgreSQL Query
Description
Section titled “Description”The PostgreSQL Query module allows executing SQL queries on PostgreSQL databases. It supports dynamic variables in the query, flexible SSL configuration (including true, require, prefer modes and custom SSL objects), and robust credential validation. Results include metadata with connection information and the executed query. It is ideal for reading and writing data in PostgreSQL within automated workflows.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | PostgreSQL connection credentials |
| query | code | Yes | SQL query to execute (supports {{variable}} variables) |
Credentials
Section titled “Credentials”The credential must contain the fields:
host: PostgreSQL server address (required)user: Database user (required)password: User passworddatabase: Database name (required)port: Connection port (default: 5432)ssl: Optional SSL configuration (true,"require","prefer", or a custom SSL object)
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": [ { "id": 1, "nombre": "Ejemplo", "email": "test@test.com" } ], "_meta_": { "rowCount": 2, "queryExecuted": "SELECT * FROM usuarios", "connectionInfo": { "host": "localhost", "database": "midb", "ssl": false } }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "credentials_id": "cred_postgres_01", "query": "SELECT * FROM productos WHERE activo = true LIMIT 100"}- Supports dynamic variables
{{variable}}in the SQL query - SSL configuration is automatically detected from the credentials
- If
sslistrueor"true", SSL is enabled withrejectUnauthorized: false(common for cloud providers) - If
sslis"require", SSL is enabled with certificate validation - The connection is always closed in the
finallyblock - Required fields (host, user, database) are validated before attempting the connection
- In case of error, the PostgreSQL error code and executed query are included
Related Nodes
Section titled “Related Nodes”- sqlQueryPostgresSSL (PostgreSQL queries with SSL certificates)
- sqlQuery (MySQL queries)
- sqlQueryMSSQL (SQL Server queries)
- sqlQueryOracle (Oracle queries)