简体   繁体   中英

pgAdmin4 import file error - can't find file

I'm having a problem importing a csv file to pgAdmin4 on a mac - it simply can't find the file. This is so simple that I'm hoping there's just a setting I've failed to set up.

In the import/export data function on a table, there is the Import/Export dialog that looks like this: 在此处输入图片说明

However, it can't find the file: 在此处输入图片说明

That error looks like the standard python error when you give it the wrong path to a file. But it's correct - that's where the file is: '/tmp/person616.csv' - I didn't even enter the name/path, I browsed to it.

Has this happened to anybody else? Know how to fix it?

The exact problem has been bothering me for quite some days now. There are not much resources available to address it. So here's what I did:

  1. I created a new folder giving it a strange name making sure that it is unique under the "/" directory and in the pgAdmin4 panel you're in rn.

  2. I used below commands to find the new strange named folder that I just created: (i) sudo su (ii) find -iname [strange named folder] -type d

  3. And after some time here it was. My path was revealed.

In my case, the path was /var/lib/pgadmin/storage/[pgAdmin4_username]

I suspect that path for "PostgreSQL Binary Path" is not set properly in pgAdmin4.

In pgAdmin4 Goto:

File > Preferences > Paths > Binary paths > PostgreSQL Binary Path

Sample paths as below (You need to change it according to your Postgres location),

If you are using Windows than provide path like,

C:\\Program Files\\PostgreSQL\\9.6\\bin

If you are using Linux than provide path like,

/opt/PostgreSQL/9.5/bin

If you are using Mac than provide path where you have installed PG,

/Library/PostgreSQL/9.6/bin

And try again.

I just had the same problem and found the solution. PGAdmin4's root directory is not your root directory. It starts at

/home/[your_username]/.pgadmin/storage/[your PGAdmin_username]/

So if you put your file or backup directories there, it can find the files.

It also helps to have it show "all" files in the backup dialog, so it can find files with your own extensions. eg I use `filename.custom' which it doesn't recognize.

In pgAdmin, when you right-click on a database and click Restore , in the bottom-right corner of the mini-interface, just above the Select button, you can see Format 'dorpdown-list' . Make sure that the drop-down list isn't limiting your displayed files, so select All Files .

Right click on table > import/export > Toggle "Import" mode > select file > Upload Files then select each for every table

如何在 pgAdmin 4 上导入文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM