노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

ERROR: could not open file "xxx.csv"

Permission denied SQL state: 42501


-- PostgreSQL, CSV를 Table로 import 하는 경우에 발생


Table Import :

create table iptables
(
   ip varchar(50)
)

> copy iptables(ip) from C:\Users\denis\Desktop\import_local.csv delimiters ',' csv header


다음과 같은 Error 발생하는 경우 :

ERROR: could not open file "C:\Users\denis\Desktop\import_local.csv" for reading: Permission denied SQL state: 42501


해결책 :

C:\Program Files\PostgreSQL\9.5\scripts아래에 csv파일을 옮긴다.


그리고, Import 진행

1. 명령어 : 

copy iptables(ip) from 'C:\Program Files\PostgreSQL\9.5\scripts\import_local.csv' delimiters ',' csv header


2. pgAdmin 이용 :

https://stackoverflow.com/questions/2987433/how-to-import-csv-file-data-into-a-postgresql-table


추가 에러 : datestyle error

> show datestyle 

"ISO,YMD"

> set datestyle="ISO,MDY"

> copy temp.a_table(regdate)

from "c:\Program Files\PostgreSQL\9.5\scripts\aaa.csv' delimiter ',' csv header



블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,