How to load data from a text file in a PostgreSQL database?

后端 未结 4 847
無奈伤痛
無奈伤痛 2020-12-14 17:06

I have a file like (CSV file):

value1|value2|value2....

value1|value2|value2....

value1|value2|value2....

value1|value2|value2....

and w

4条回答
  •  -上瘾入骨i
    2020-12-14 17:39

    The slightly modified version of COPY below worked better for me, where I specify the CSV format. This format treats backslash characters in text without any fuss. The default format is the somewhat quirky TEXT.

    COPY myTable FROM '/path/to/file/on/server' ( FORMAT CSV, DELIMITER('|') );
    

提交回复
热议问题