Tibor
Tibor

Reputation: 181

How to copy from zip in the pipe into postgresql table without psql console?

In the psql console works the following statment:

\copy fcd_in ("column_1", "column_2", "column_3") FROM PROGRAM 'unzip -p c:\tmp\tmp.zip' WITH DELIMITER AS ';' NULL as 'null' CSV header;

In DBeaver i get for the same statment:

copy fcd_in ("column_1", "column_2", "column_3") FROM PROGRAM 'unzip -p c:\tmp\tmp.zip' WITH DELIMITER AS ';' NULL as 'null' CSV header;

SQL-Fehler [38000]: FEHLER: Programm »unzip -p c:\tmp\los\los_HERES201R2.zip« fehlgeschlagen Detail: Kindprozess hat mit Code 1 beendet

Upvotes: 0

Views: 204

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247445

With \copy, PROGRAM refers to a program on the client machine, while with COPY it refers to a program on the database server machine. That explains the different behavior.

Upvotes: 1

Related Questions