Run pg_dump against a direct (non-pooled) connection string and omit the -F format flag to get plain SQL. The output is a plain .sql file you can read, edit, commit to version control, or replay with psql. See Migrate data from Postgres with pg_dump and pg_restore for the full command reference.

Export a plain SQL dump

Click Connect in the Neon Console nav and turn Connection pooling off to get the direct connection string (no -pooler in the hostname). Then run:

pg_dump -d "postgresql://alex:AbC123dEf@ep-cool-darkness-a1b2c3d4.us-east-2.aws.neon.tech/neondb?sslmode=require&channel_binding=require" -f dump.sql

The result is a SQL script that recreates the schema, data, and other objects in dependency order.

Useful flags

# Schema only, no data
pg_dump -d "$NEON_URL" --schema-only -f schema.sql

# Data only, no DDL
pg_dump -d "$NEON_URL" --data-only -f data.sql

# Skip ALTER OWNER statements (recommended when restoring to a different role)
pg_dump -d "$NEON_URL" --no-owner -f dump.sql

# One specific table
pg_dump -d "$NEON_URL" -t public.customers -f customers.sql

Use --no-owner when you'll restore into Neon under different roles. Roles created through Neon are members of neon_superuser, which isn't a full Postgres superuser and can't run ALTER OWNER, so those statements would fail during the restore. See Database object ownership considerations.

Plain SQL vs custom format

A custom-format archive (-Fc) is compressed and lets pg_restore restore selected objects or run in parallel:

pg_dump -Fc -d "$NEON_URL" -f dump.dump
pg_restore -d "$TARGET_URL" dump.dump

Choose plain SQL when you want to read, edit, or grep the output, or replay it with psql -f dump.sql. Choose -Fc when you want to restore selectively or in parallel.

Don't dump over a pooled connection

pg_dump uses session-level SET statements, which Neon's PgBouncer doesn't support in transaction mode. Use the direct hostname (no -pooler segment) for dumps. See PgBouncer issues 452 and 976 for background.

Match client and server versions

Use pg_dump from the same major Postgres version as your Neon project, or newer. Run pg_dump -V to check. pg_dump refuses to dump a server whose major version is newer than its own.

See the full pg_dump reference for Neon

Includes parallel dumps, ownership handling, large objects, and piping pg_dump to pg_restore.