"SELECT * FROM Guests"
reports:
terminate called after throwing an instance of 'pqxx::undefined_table'
what(): ERROR: relation "guests" does not exist
but the table exists! The solution is to put table name in double
quotation marks. Single quotation marks will not work. This should work
OK:
"SELECT * FROM \"Guest\""
Same goes for column names:
"SELECT Name FROM \"Guest\""
throws:
terminate called after throwing an instance of 'pqxx::undefined_column'
what(): ERROR: column "name" does not exist
This corrected version, however, does not throw any error:
"SELECT \"Name\" FROM \"Guest\""
I'm not sure why. The PostgreSQL documentation doesn't mention this and there are numerous examples on the Internet that claim to work and have no quotation marks in front and after each column name and table name.
Previous:
pqxx::broken_connection
Next:
How to build QT4 projects in console