PostgreSQL_IO


PostgreSQL

Load data

psqlから、

\copy tablename from 'filename' with csv;
または
\copy (tablename) from '(filename)' using delimiters ','

でいける(filenameは、サーバのfullpath)。

  • with csv/using delimiters等を略すと、TAB区切りになる。
  • with null as ''をつけると、データ内の空文字がNULLと変換される。
    \copy (tablename) from 'C:\xxx.tsv' with null as '';