Skip to content

pgDump

pgDump(__namedParameters): Promise<File>

Defined in: packages/pgwasm-pg-dump/src/pg-dump.ts:227

Dump a database with pg_dump, as a File: by default a plain SQL script of INSERT statements, which exec() runs back into an empty database.

pg_dump runs on the database’s own session, which it holds for the whole dump: no query, transaction or other dump of this database runs until it is done, and none can be running inside a transaction block when it starts (PgDumpSessionError). Afterwards the session is as it was: pg_dump’s transaction ended, its prepared statements gone, every setting it changed restored. It must not be called inside a pg.transaction() callback: it would wait forever for the session that transaction holds.

PgDumpOptions

Promise<File>

the database’s build cannot run pg_dump (checked first).

pg_dump failed; it carries the exit code and standard error.

the session was inside a transaction block, or could not be restored (then, when pg_dump had failed too, its failure is the cause).