Answer the question
In order to leave comments, you need to log in
How to import data into PostgreSQL DB via psql to remote server?
I'm trying to upload data from a text file to a remote server in a PostgreSQL database.
@echo off
"C:\PostgreSQL\11\bin\psql.exe" -h srv.local -U postgres -d postgres -p 5432 -c "COPY datatest FROM 'C:/1.txt' DELIMITER '|' CSV HEADER"
pause
ОШИБКА: не удалось открыть файл "C:/1.txt" для чтения: No such file or directory
ПОДСКАЗКА: COPY FROM указывает серверному процессу PostgreSQL прочитать данные из файла. Возможно, на самом деле вам нужно клиентское средство, например, \copy в psql.
Для продолжения нажмите любую клавишу . . .
Answer the question
In order to leave comments, you need to log in
The command COPY
reads the file on the server, not where you started psql.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question