'Can't read CSV file with pgAdmin4, could not open file - Permission denied
I started to learn PostgreSQL and pgAdmin 4. I have a problem with reading CSV file from desktop. I looked all over the web and this website but I could not find the answer. I get this error:
ERROR: could not open file "C:\Users\Jasmina\Desktop\OnlineRetail2.csv" for reading: Permission denied
SQL state: 42501
I have tried to use /copy but still does not work. Whats the problem, what am I doing wrong?4
CREATE TABLE Public."My_OnlineRetail"(InvoiceNo int,
StockCode varchar(100),
Description varchar(100),
Quantity int,
InvoiceDate timestamp,
UnitPrice float,
Currency varchar(10),
CustomerID int,
Country varchar(100));
SELECT * FROM Public."My_OnlineRetail";
COPY Public."My_OnlineRetail" FROM 'C:\Users\Jasmina\Desktop\OnlineRetail2.csv' DELIMITER ',' CSV HEADER;
Solution 1:[1]
For those still looking for an answer, in my case under Windows Server, the account (or default user) the PostgreSQL server runs is 'NETWORK SERVICES'.
You can check this by going to
'Services' -> 'postgresql...' -> Properties (via Right Click) -> Log On (Second Tab)
.
You can then add permissions for the account on the file you wish to COPY to 'Read'.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pranav Singh |
