I'm seeing an odd behaviour – if I don't wrap my schema name in quotes, the server returns
[42601] ERROR: syntax error at or near "."
The query is simply:
select count(*) from "authorization".logins
Here's what psql \dn
shows:
List of schemas
Name | Owner
---------------+---------
authorization | user_login
(1 row)
Schema name doesn't contain upper case letters, only English ones. Tried it using DataGrip and Npgsql (.NET driver for PostgreSQL).
DataGrip added quotes around schema name, when with others it doesn't do so.
Table and schema was created and applied via Flyway
Best Answer
authorization
is a reserved keyword in Postgres, so it needs to be quoted to be used as a (database/schema/table) name. See the list: Appendix C. SQL Key WordsAnd a very popular opinion among Postgres developers - to avoid the complications - is:
Do not use reserved words as identifiers.