1

im trying to export my table from Postgresql (RDS) on Amazon Web Services using the following command:

psql -t -A -F"," -c "select * from Album" > album.csv -h amazon-instance -p 5432 -U username -W -d chinook

I get this error message:

ERROR:  relation "album" does not exist
LINE 1: select * from Album

The reason for that error message is that my table starts with a capital (A)lbum so how can I escape my command to make this work?

Thank You

4
  • check if you have a table called album in your database Commented Jan 23, 2016 at 16:43
  • Yes I have this table but it starts with upper 'A' so postgres does not recognize the upper characters. Commented Jan 23, 2016 at 17:18
  • Search postgresql.org/docs/current/static/sql-syntax-lexical.html for "quoting an identifier". Commented Jan 23, 2016 at 17:21
  • Bingo got it working, escaped my command like this: -c "select * from "\""Album\"" Commented Jan 23, 2016 at 17:24

1 Answer 1

3

I had to escape the capital letter in the Album table on my psql command as follows:

psql -t -A -F"," -c "select * from "\""Album\"" > album.csv -h amazon-instance -p 5432 -U username -W -d chinook
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.