Postgres ERROR: could not open file for reading: Permission denied

前端 未结 15 2266
慢半拍i
慢半拍i 2020-12-04 13:15

Computer: Mac OS X, version 10.8 Database: Postgres

Trying to import csv file into postgres.

pg> copy items_ordered from \'/users/darchcruise/desk         


        
相关标签:
15条回答
  • 2020-12-04 13:43

    Copy the CSV file to /tmp

    For me this solved the issue.

    0 讨论(0)
  • 2020-12-04 13:45

    For me it worked to simply to add sudo (or run as root) for the chown command:

    sudo chown postgres /users/darchcruise/desktop/items_ordered.csv

    0 讨论(0)
  • 2020-12-04 13:46

    Another way to do this, if you have pgAdmin and are comfortable using the GUI is to go the table in the schema and right click on the table you wish to import the file to and select "Import" browse your computer for the file, select the type your file is, the columns you want the data to be imputed into, and then select import.

    That was done using pgAdmin III and the 9.4 version of PostgreSQL

    0 讨论(0)
  • 2020-12-04 13:46

    May be You are using pgadmin by connecting remote host then U are trying to update there from your system but it searches for that file in remote system's file system... its the error wat I faced May be its also for u check it

    0 讨论(0)
  • 2020-12-04 13:52

    for macbook first i opened terminal then type

    open /tmp
    

    or in finder directory you directly enter command+shift+g then type /tmp in go to the folder.

    it opens temp folder in finder. then i paste copied csv file into this folder.then again i go to postgres terminal and typed below command and then it is copied my csv data into db table

    \copy recharge_operator FROM '/private/tmp/operator.csv' DELIMITER ',' CSV;
    
    0 讨论(0)
  • 2020-12-04 13:53
    COPY your table (Name, Latitude, Longitude) FROM 'C:\Temp\your file.csv' DELIMITERS ',' CSV HEADER;
    

    Use c:\Temp\"Your File"\.

    0 讨论(0)
提交回复
热议问题