Import and export PostgreSQL data
Export PostgreSQL tables and query results, import structured data and use pg_dump and pg_restore from Tablyne.
PostgreSQL has the broadest data-movement workflow in the current app. The export dialog can work from a table, a group of tables or a query result, and it shows a preview before starting the job.
Export data
- Choose the table, filtered rows, selected rows or query result.
- Choose CSV, JSON, JSON Lines, SQL, Markdown or XLSX.
- Review the estimated row count and output options.
- Pick a destination and start the export.
CSV options include delimiter, quote policy, null representation, line ending, encoding, decimal separator and formula escaping. JSON can be an array, an object keyed by primary key or JSON Lines. SQL can include INSERT statements, multi-row INSERTs, COPY or upsert, with PostgreSQL-specific options such as schema qualification and sequences.
Consistency and what the export holds on the server
- Each table is read by one query inside a short
REPEATABLE READ READ ONLYtransaction, so the file is one consistent snapshot of the table even while other sessions write to it. - When several tables are exported together, they all come from the same moment: a short transaction exports a snapshot (
pg_export_snapshot()) and each table’s transaction imports it (SET TRANSACTION SNAPSHOT). That holding transaction reads no table, so it holds no table lock. - A table’s lock (
ACCESS SHARE) is released as soon as that table is written, so anALTER TABLEorTRUNCATEon a table that was already exported does not wait for the whole job. - The export’s transactions set
statement_timeoutandidle_in_transaction_session_timeoutto 0 locally, so a role or database timeout does not cut a long table or the export while the XLSX or zip is being finished. Canceling the job stops the query on the server. - If the server cannot share a snapshot (for example,
pg_export_snapshot()is not available), each table is read from its own snapshot and the job result says so. - The transaction that holds the shared snapshot stays open for the whole export (a single-table export holds its read transaction for the length of the table). While it is open it holds the cleanup horizon (
xmin):VACUUMcannot remove row versions that changed after the export started. An export that runs for hours on a cluster with heavy writes can accumulate bloat, so run long exports at a quieter time or split them. - On a hot standby, a long read can be canceled by a conflict with recovery. The error says so; export from the primary or turn on
hot_standby_feedbackon the replica. - The table filter (“where…”) and the raw
WHERErun in the read-only transaction: a filter that callsnextval()or a function that writes is refused by the server.
Import data
The PostgreSQL import workflow analyzes a CSV, JSON or XLSX file before the write begins. Review the detected columns, mapping and operation, then start the import only after the preview is acceptable. The app keeps the import job separate from the query console so progress and cancellation remain visible.
Dump and restore
PostgreSQL also exposes pg_dump and pg_restore from the app. The configured pg_dump path can be detected from PATH or a standard installation, selected manually, or supplied by the bundled tools when available. A restore can be previewed before it runs.
When the server is not on this computer and the saved SSL mode accepts a session without TLS (prefer, allow or disable), the app checks the session it opened with the server before starting the tool. If that session uses TLS, the tool is started with sslmode=require. If it does not, a tool from PostgreSQL 16 or newer only accepts SCRAM or no password exchange, and an older tool (including the YugabyteDB ysql_dump and ysqlsh, which have no release 16 to switch to) is refused before the password is written anywhere. Behind a connection pooler such as PgBouncer, the app’s session describes the link from the pooler to the database, not from this computer to the pooler; enable TLS on the pooler as well, pick require or verify-full, or use an SSH tunnel.
Use Ctrl+E to open data export and Ctrl+S to save pending grid changes. Exporting does not commit staged edits; review and commit those changes separately.