Psql -c is lowering my table name

Asked

Viewed 31 times

1

Hello,

I am executing the following command:

psql -d copia-local -U postgres -c "COPY "Questions" FROM '/home/pedro/Documents/PostGre/data/cooked/Questions_cooked.txt' WITH DELIMITER '|' NULL AS ''"

ERROR:  relation "questions" does not exist

The interesting thing is that if I execute the command inside the database of Postgresql, works:

copia-local=# COPY "Questions" FROM '/home/pedro/Documents/PostGre/data/cooked/Questions_cooked.txt' WITH DELIMITER '|' NULL AS '';
COPY 1342

I searched the parameters of psql but I found nothing about respecting the table name, it seems that when I run by psql it lowercase in the table name.

Does anyone have any idea what to do ?

1 answer

0

Put the escape character in the name of your table:

psql -d copia-local -U postgres -c "COPY \"Questions\" FROM '/home/pedro/Documents/PostGre/data/cooked/Questions_cooked.txt' WITH DELIMITER '|' NULL AS ''"
  • It worked, thank you very much !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.