Skip to main content

Description

PostgreSQL is a popular relational database system. This component allows you to query a PostgreSQL database.

Query formatting

Instead of generating dynamic queries and sanitizing SQL manually, it is possible to use generic queries with query formatting. Formatted queries can either use numbered parameter placeholders like $1, $2, etc., or can use named parameter placeholders like ${variableKey}.

Index variables

Index variables are numbered parameter placeholders like $1, $2, etc. To use index variables, write a query that uses indexed placeholders (e.g. SELECT * FROM users WHERE id = $1 AND name = $2). Then, generate an array like [5, "John Doe"] and reference it from the Parameters Object or Array input.

Note: When indexed variables are used, named variables cannot be used in the same query.

Named variables

Named variables are written in the form ${variableKey}, $<variableKey> or $(variableKey). For example, enter a query that reads INSERT INTO users (name, email) VALUES (${name}, ${email}). Then, enter values with keys of name and email, along with any desired values, as Named Parameters Inputs. Values provided as variables are sanitized automatically.

When dynamically generating SQL queries and the required parameters are not known ahead of time, create a key/value object in another step and reference it through the Parameters Object or Array input. In the example above, the object could take the form {name: "John doe", email: "john.doe@example.com"}.

Connections

On-Premise Connection

key: postgres

Create a new PostgreSQL connection and enter the connection details for the PostgreSQL server.

Configure the Connection

  • Enter the Host, the hostname or IP address of the PostgreSQL server (e.g., 192.168.0.1).
  • Enter the Port of the PostgreSQL server (default: 5432).
  • Enter the Database name to connect to.
  • Optionally enter a Username and Password to authenticate to the PostgreSQL server.
  • Set Require SSL to require an SSL connection to the PostgreSQL server.
  • Optionally set a Connection Timeout in milliseconds to wait before timing out (default: 5000).

On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.

InputNotesExample
Database

The name of the database to connect to.

admin
Host

The hostname or IP address of the PostgreSQL server.

192.168.0.1
Password

The password used to authenticate to the PostgreSQL server.

Port

The port of the PostgreSQL server.

5432
Require SSL

When true, requires an SSL connection to the PostgreSQL server.

false
Connection Timeout

The amount of time (in milliseconds) to wait for a connection to be established before timing out. Default is 5000ms.

5000
Username

The username used to authenticate to the PostgreSQL server.

Triggers

New and Updated Records

Checks for new and updated records in a table on a configured schedule. | key: pollTable

InputNotesExample
Cast Timestamps to Strings

When true, timestamp values are cast to strings to retain precision. PostgreSQL tracks microseconds, but JavaScript dates are measured in milliseconds, so precision can be lost when fetching TIME, TIMETZ, TIMESTAMP, and TIMESTAMPTZ fields. Enable this when the cursor field is a timestamp.

true
Cursor Field

The column used to track new results. If the table has an auto incrementing integer ID, that ID can be used. If it has a 'created at' or 'updated at' timestamp, those can be used. Each time this trigger runs, it checks for records with values greater than the largest value from the last run.

updated_at
Connection

The PostgreSQL connection to use.

Table Name

The name of the table to monitor for new and updated records.

people
Example Payload for New and Updated Records
Loading…

Actions

Query

Performs a query on a PostgreSQL database. | key: query

InputNotesExample
Named Parameters

Optional named parameters to insert into a query.

Parameters Object or Array

Optional parameters to insert into a query. This should be a key-value object if you are using named inputs (i.e. ${name}), or an array if using index variables (i.e. $2) in your query. Values from this object will be merged with Named Parameters inputs if you are using named variables.

{"productId":123,"customerName":"Acme Corp"}
Connection

The PostgreSQL connection to use.

Query Field

The SQL statement to execute against the database. Use named parameters (i.e. ${name}) or index variables (i.e. $1) to safely interpolate values.

INSERT INTO users(first_name, last_name, age) VALUES(${firstname}, ${lastname}, ${age})
Example Payload for Query
Loading…

Changelog

2026-06-29

Various modernizations and documentation updates

2026-04-30

Updated spectral version

2026-03-13

Removed the Debug Request input from all action inputs. Debug logging is now controlled internally and no longer appears as a configurable field in actions.

2025-11-25

Enhanced webhook triggers to support simulated test executions for improved manual testing capabilities