23

How do I save a query in pgAdmin 4? No matter where I try to save it within the PostgreSQL file or the pgAdmin 4 file, the result is that I do not have access.

C:\Program Files\PostgreSQL\9.6\pgAdmin 4\

I have tried both bin files, data files, and many other files.

It always says that I don't have access.

I see that I can save data output as a CSV file, but I want the actual query.

If I close pgAdmin, I lose everything in the query.

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
Katydid
  • 331
  • 1
  • 2
  • 7

5 Answers5

21

I assuming that query means that you type query in Query tool.

Default location: C:\Users\YOUR_USERNAME_HERE\AppData\Roaming\pgAdmin\storage

enter image description here

enter image description here

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
8

Generally when we click the save button a window is opened(look at fig1). We can see that create option is disabled.

What to do? Just write the file_name.sql at that address(look at fig2). We can see that create option is enabled. Click on create button to save.

3

You have to write the file name in the location. For example: C:\Users\YOUR_USERNAME_HERE\AppData\Roaming\pgAdmin\storage\query1.sql

0

In ubuntu 20.04 pgadmin 4 saves files on the following path

/var/lib/pgadmin/storage/your_user/files
desertnaut
  • 57,590
  • 26
  • 140
  • 166
jahmed31
  • 3,456
  • 3
  • 23
  • 23
0

when you click on the save button you select the folder you want to save the query in, when you choose it, in the path, literally, after the / enter what you want to name the created file, you will notice that the create button is enabled as you type!

desertnaut
  • 57,590
  • 26
  • 140
  • 166