Export Backup in postgresql in pgAdmin4
Oct 31, 2025 in Uncategorized by admin
Search in google “export create insert sql postgresql via pgadmin4”
To export a backup SQL query containing CREATE and INSERT statements using pgAdmin 4:
- Select the Object: In the pgAdmin 4 browser tree, navigate to and right-click on the database, schema, or table you wish to back up.
- Open Backup Dialog: From the context menu, select “Backup…”.
- Specify File Path and Format:
- In the “Filename” field, provide a path and name for your backup file (e.g.,
/path/to/my_backup.sql).
- Set the “Format” dropdown to “Plain”. This ensures the output is a human-readable SQL script.
- Configure Options for
INSERT Statements:
- Navigate to the “Options” tab within the Backup dialog.
- Under the “Data Options” section, ensure the “Data” switch is toggled to the right (enabled) to include actual table data.
- Crucially, within the “Data Options” or “Options” tab (depending on pgAdmin version), locate and enable the option like “Use INSERT commands” or “Use Column Inserts” to generate
INSERT statements instead of COPY commands.
- Initiate Backup: Click the “Backup” button to start the process. pgAdmin 4 will execute the
pg_dump utility with the specified options and save the SQL script to your chosen file.
- Verify Output: After the backup completes, open the generated
.sql file with a text editor to confirm it contains both CREATE TABLE statements (for schema definition) and INSERT statements (for data).