Thursday, January 2, 2020

Unknown knowns: Postgresql (psql) Case Sensitivity Borderline Buggish

I could not find much literature on why POSTGRESQL is case sensitivity is no consistent. Obviously, it can be worked around but not very intuitive to someone new to Postgres but is experienced with other databases.

My "problem" with Postgres in my first hour was creating a table and querying the table. Postgres forces lower-case on the table name when creating if no double-quotes are used. But when you query the table, the syntax is case-sensitive so will not find the table because they are not the same cases.

Most literature I read just explains that this happens. Some argue that this is not a case-sensitivity issue, which I suppose is kind of, maybe technically true. But seriously, if I type in any language:

CREATE TABLE AbcDef

I would most definitely think that, "SELECT * FROM AbcDef", should most definitely work whether the system records the table the same way I named it.

I am just saying even if Postgres lower-cased AbcDef to abcdef, it should also search for table abcdef when I query by AbcDef. And if I really want it to be AbcDef with double-quotes, then I use double-quotes in my query. And this is why I think this is kind of buggish.


If it weren't for me trying to gain some experience with Postgres, I feel this is probably enough for me to start gaining more experience with MySql. Although the object-oriented portion is a bit intriguing. 

No comments:

Post a Comment