Closed kostya closed 1 year ago
ok, after some googling, i found that i need to add quotes. "select id from \"my_DATA\" limit 1"
Yeah this would be the same as if you were running the query in psql
. Most ORMs will auto quote everything to avoid problems, but I don’t think that's appropriate for the driver itself to do.
I tend to keep all table and column names lowercase just to avoid having to quote.
You might also want to use the %()
strings to avoid having to do backslashes everywhere. db.query(%q(select id from "my_DATA" limit 1))
With downcased tables it works. In ruby it works with any case.
Unhandled exception: relation "my_data" does not exist (PQ::PQError) from lib/pg/src/pq/connection.cr:215:7 in 'handle_error' from lib/pg/src/pq/connection.cr:198:7 in 'handle_async_frames' from lib/pg/src/pq/connection.cr:174:7 in 'read' from lib/pg/src/pq/connection.cr:169:7 in 'read' from lib/pg/src/pq/connection.cr:447:31 in 'expect_frame' from lib/pg/src/pq/connection.cr:446:5 in 'expect_frame' from lib/pg/src/pg/statement.cr:18:5 in 'perform_query' from lib/db/src/db/statement.cr:93:9 in 'perform_query_with_rescue' from lib/db/src/db/statement.cr:80:7 in 'query:args' from lib/db/src/db/pool_statement.cr:29:30 in 'query:args' from lib/db/src/db/query_methods.cr:46:7 in 'query:args' from lib/db/src/db/query_methods.cr:61:7 in '__crystal_main'