开发者

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

I designed a set of table开发者_开发知识库s 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?


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.


You may check the relative wiki to get the precise answer

Why are my table and column names not recognized in my query? Why is capitalization not preserved?

Hope it clarifies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜