Importing .csv with timestamp column (dd.mm.yyyy hh.mm.ss) using psql \copy

后端 未结 3 492
天涯浪人
天涯浪人 2020-12-03 18:17

I\'m trying to import data from a .csv file into a postgresql 9.2 database using the psql \\COPY command (not the SQL COPY).

The input .csv file contains

3条回答
  •  有刺的猬
    2020-12-03 18:58

    Have you tried setting the datestyle setting of the server?

    SET datestyle = 'ISO,DMY';
    

    You are using the psql meta-command \copy, which means the input file is local to the client. But it's still the server who has to coerce the input to matching data-types.

    More generally, unlike the psql meta-command \copy which invokes COPY on the server and is closely related to it .. I quote the manual concerning \set:

    Note: This command is unrelated to the SQL command SET.

提交回复
热议问题