PostgreSQL (destination)
BUILDING Destination · built and tested, not yet verified against production accounts. Contact us before relying on it.
Overview
Section titled “Overview”PortPilot loads each synced table into a PostgreSQL table in the schema you choose, using
COPY, PostgreSQL’s bulk loader. Changed rows are merged with INSERT … ON CONFLICT on the
primary key. Tables (with primary keys) and new columns are created automatically.
Works with self-managed PostgreSQL and managed services (RDS, Aurora, Cloud SQL, AlloyDB, Supabase, Neon).
Before you connect
Section titled “Before you connect”-
Create a user and schema for PortPilot:
CREATE USER portpilot WITH PASSWORD '<strong password>';CREATE SCHEMA IF NOT EXISTS raw AUTHORIZATION portpilot;Owning the schema lets PortPilot create, alter, truncate and load its tables. To use an existing schema instead, grant
USAGE, CREATEon it, andTEMPORARYon the database. -
Allow network access. Allowlist PortPilot’s egress IPs (shown on the destination screen). With a bring-your-own-cloud deployment, allow your own PortPilot agent’s network instead.
Connect
Section titled “Connect”In the app, go to Destinations → New destination → PostgreSQL and click Test connection after filling in:
| Field | Required | Default | Description |
|---|---|---|---|
host |
Yes | — | Hostname or IP address. |
port |
Yes | 5432 |
Port. |
database |
Yes | — | Target database. |
user |
Yes | — | The user created above. |
password |
Yes | — | Stored write-only in the data plane’s secret store. |
ssl_mode |
No | require |
require, verify-full or disable. |
schema |
No | public |
Target schema, e.g. raw. |
Schema
Section titled “Schema”- Tables are named after the source table or stream and created on the first load. Table and column names keep the source spelling.
- Tables are created with a
PRIMARY KEYon the source's key columns. - Names are quoted, so mixed-case names keep their case (
"AnnualRevenue") and reserved words such asuserwork. Quote mixed-case names in queries. - New columns are added with
ALTER TABLE … ADD COLUMN. Existing columns are never changed or dropped. - No PortPilot metadata columns are added.
| PortPilot type | Destination type |
|---|---|
| integer | BIGINT |
| number | DOUBLE PRECISION |
| boolean | BOOLEAN |
| object | JSONB |
| array | JSONB |
| string | TEXT |
Sync behavior
Section titled “Sync behavior”| Write mode | When | What happens |
|---|---|---|
| Upsert | Tables with a primary key | COPY into a temporary table, then one INSERT … SELECT … ON CONFLICT (key) DO UPDATE. If a sync has the same key twice, the last one wins. |
| Replace | Full reads of tables without a primary key | TRUNCATE, then COPY. |
| Append | Incremental reads of tables without a primary key | COPY. |
Common gotchas
Section titled “Common gotchas”- Existing tables need a unique key for upserts. For a table without a primary key or unique index on the key columns, PortPilot creates a unique index on the first upsert. If the table already has duplicate keys, the sync fails and names the duplicated key: deduplicate or truncate the table, then re-run.
- Timestamps land as
TEXT. Cast them (created_at::timestamptz) in a view. - Mixed-case column names need quotes in queries:
SELECT "AnnualRevenue" FROM …. - Deletes aren’t replicated. Rows deleted at the source stay in the destination.