165

I am using pgAdmin version 1.14.3. PostgreSQL database version is 9.1.

I got all Db script for table creation but unable to export all data inside tables. Could not find any option to export data in db script form.

2

3 Answers 3

226
  1. Right-click on your table and pick option Backup..
  2. On File Options, set Filepath/Filename and pick PLAIN for Format
  3. Ignore Dump Options #1 tab
  4. In Dump Options #2 tab, check USE INSERT COMMANDS
  5. In Dump Options #2 tab, check Use Column Inserts if you want column names in your inserts.
  6. Hit Backup button

Edit: In case you are using pgAdmin on a remote server: Once the UI announces the backup was successful, you might want to download the data. For this, follow these steps:

  1. Click on Tools (in the menu)
  2. Select Storage Manager
  3. Select the file that was just created
  4. Click on the small "Download File" button
8
  • 13
    where this backup went? Dec 24, 2018 at 8:11
  • 3
    Maybe this work if your DB is in local. In my case, there is a message announcing the victory, but the file disappears on the server. I want to DOWNLOAD it on my computer. :/
    – fresko
    Feb 19, 2019 at 13:38
  • 9
    pgAdmin is most ridiculous IT tools I've ever used. There's anything like UX in pgAdmin.
    – cadavre
    Jan 21, 2020 at 9:33
  • 3
    I couldn't find the file that was generated, so I ended up using the command that pgAdmin used (click on "More Details" in pgAdmin after running Backup), and opening a shell on the server and running the same command, then I could copy the file.
    – ccallendar
    Jul 15, 2020 at 20:07
  • for File Name give a file with a full path (eg: /home/xxx/yyy/backup.sql"), Then if it gives an error saying cannot find that message has the default path it tries to save. Jun 24, 2021 at 16:29
166

Just right click on a table and select "backup". The popup will show various options, including "Format", select "plain" and you get plain SQL.

pgAdmin is just using pg_dump to create the dump, also when you want plain SQL.

It uses something like this:

pg_dump --user user --password --format=plain --table=tablename --inserts --attribute-inserts etc.

10
  • 11
    it generates dump having table data script starts with COPY command not INSERT. Anyway to generate script with INSERT commands. Jun 29, 2012 at 7:42
  • 8
    That's why you have to create plain SQL. When using the dump option INSERT, you get ordinary INSERT queries Jun 29, 2012 at 7:56
  • 1
    @Pixel Elephant: If performance matters, you should use COPY. It's much faster. Nov 14, 2012 at 7:01
  • 24
    In pgAdmin III 1.16.1, "Use Insert commands" is under Dump Option #2.
    – jpmc26
    Aug 18, 2013 at 1:31
  • 2
    In pgAdmin III 1.18.1, Select Plain for Format under File Option and than check "Use Insert commands" under Dump Option #2.
    – bhdrkn
    Dec 29, 2014 at 15:11
24

In the pgAdmin4, Right click on table select backup like this

enter image description here

After that into the backup dialog there is Dump options tab into that there is section queries you can select Use Insert Commands which include all insert queries as well in the backup.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.