16

Is it possible? If so how?

I can only find solution for pgadmin 3 which doesn't work for me.

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

4 Answers4

30

It worked like this for me:

  1. Go to your Database and click on this.
  2. Click in the menubar on Tools, Query Tools

enter image description here

  1. Then it reload the page. Above the menubar on the left, you see the folder-icon (look picture below). Click on them and choose your .sql file
  2. Click on select and the file is uploaded
  3. To execute the .sql file, press F5 or the play button above the menubar in the middle (look at the screenshot below).
  4. Right click on your database and click on 'Refresh'.

enter image description here

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
  • I'm importing the sql file like as the answer mentioned above but it says `File type not supported`. my file is like `test.sql`. – sumanth Aug 08 '23 at 07:20
9

Following are the step that will help you in importing all tables of your schema

1) Open pgAdmin 4

2) Navigate to Your Database Name --> Schemas --> public

3) Then right click on public

4) After clicking on public then select Restore option from DropDown Menu

5) A window will open in which you only have to give location of .sql file and leave other textboxes

6) Click Restore and leave rest on pgadmin

Note : You have to perform these steps for every single table you want to import

ShehrozEK
  • 180
  • 1
  • 1
  • 6
  • 1
    if it did not work try using pgsql Shell enter your server and database and user information then run without any quotes \i D:/folder/your_table.sql – Ahmed Aboud Mar 17 '20 at 17:15
  • In my case, DB already had data, and restore failed. To resolve it I dropped DB and created a new one assigning the same user which is used for backup. Then the answer worked for me. – Andriy Boyko Apr 26 '22 at 15:32
1

To handle this problem, follow these steps:

  1. Select your Database.
  2. Click in the menubar, select Tools & Query Tools,
  3. Import your SQL (to generate query create table)
  4. Execute query
Yunnosch
  • 26,130
  • 9
  • 42
  • 54
0

this steps:

To handle this problem, follow these steps:

Select your Database.
Click in the menubar, select Tools & Query Tools,
Import your SQL (to generate query create table)
Execute query

This working with me when importing .sql file after creating the database. Thanks

Syalah
  • 1