0
  • I'm writing java
  • I want the db to be case sensitive for table and column names
  • I don't want to quote identifiers in my sql because it'll look like this in java:
String sql = "SELECT * FROM \"Seat\"";

Is it possible to configure postgres to always treat identifiers as case sensitive, even without quotes?

tsoiland
  • 101
  • 7
  • 2
    No, that's not possible and it would violate the identifier rules of the SQL standard. It's like asking "*Can I configure my Java compiler to treat all identifiers as case-insensitive*" - it would also violate the rules of the language –  May 09 '19 at 20:50
  • Related: [Is SQL syntax case sensitive?](https://stackoverflow.com/q/153944/190597) – unutbu May 09 '19 at 20:59
  • 1
    All that said, if you never quote your identifiers, and you don't choose colliding names (e.g. "Seat" and "seat"), you won't run into a problem. Everything collapses to lowercase unless quoted, so the problem is straightforward to avoid. – jmelesky May 09 '19 at 22:07
  • @jmelesky that was my initial plan, but then a column named end needed to be quoted because it's a keyword. I got the ORM to quote everything all the time so that I don't have to configure which names are keywords, but that's how I found out that quotes also affect case sensitivity. – tsoiland May 10 '19 at 10:48

0 Answers0