163

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.

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228
Muhammad Imran Tariq
  • 22,654
  • 47
  • 125
  • 190

3 Answers3

224
  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
Sebu
  • 4,671
  • 5
  • 16
  • 29
Yusuf
  • 2,459
  • 1
  • 12
  • 5
  • 13
    where this backup went? – StealthTrails Dec 24 '18 at 08: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 '19 at 13:38
  • 9
    pgAdmin is most ridiculous IT tools I've ever used. There's anything like UX in pgAdmin. – cadavre Jan 21 '20 at 09: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 '20 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. – Janaka Peiris Jun 24 '21 at 16:29
  • @ChaudhryWaqas backup file is created under Documents folder in Windows OS. – TeachMeJava Jan 13 '22 at 09:53
  • @fresko see my edit on how to download the backup from a server – Sebu Jun 03 '22 at 10:05
  • try to create an empty text file and change the extension of it to .sql. Select the file – cristian9804 Aug 23 '23 at 10:55
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.

Alfonso Tienda
  • 3,442
  • 1
  • 19
  • 34
Frank Heikens
  • 117,544
  • 24
  • 142
  • 135
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

Keyur Lakhani
  • 4,321
  • 1
  • 24
  • 35