Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PostgreSQL / pgAdmin behave a bit better with case sensitivity?

I designed a set of tables in pgAdmin. I gave names like Products and ProductRID. I was very surprised though when I went to query this table only to find a query like this yielded unknown relation:

select * from Products

Apparently the proper way to access this is

select * from "Products"

which is very ugly. I can rename the tables to all lower case to query without quotes, but then it looks ugly. Is there any kind of a setting so that it will retain the case, but behave without case sensitivity?

like image 906
Earlz Avatar asked Nov 20 '25 21:11

Earlz


1 Answers

No there is no magic setting. The best way to deal with case sensitivity is to not quote your relations when you are creating them. If you are early on in schema design, go ahead and rename them (and column names) to lower case. The "looks ugly" problem will go away because in your queries you can still do

SELECT * FROM Products

and it will work fine.

like image 179
Scott Bailey Avatar answered Nov 22 '25 13:11

Scott Bailey