no zuo no die系列，来自于pg的wiki。
PostgreSQL folds all names - of tables, columns, functions and everything else - to lower case unless they’re “double quoted”.
So create table Foo() will create a table called foo, while create table “Bar”() will create a table called Bar.
These select commands will work: select from Foo, select from foo, select from “Bar”.
These will fail with “no such table”: select from “Foo”, select from Bar, select from bar.
This means that if you use uppercase characters in your table or column names you have to either always double quote them or never double quote them. That’s annoying enough by hand, but when you start using other tools to access the database, some of which always quote all names and some don’t, it gets very confusing.
Stick to using a-z, 0-9 and underscore for names and you never have to worry about quoting them.
[pg12@localhost ~]$ psql -d testdb Timing is on. Expanded display is used automatically. psql (12.0) Type "help" for help. [local]:5432 pg12@testdb=# select id as "Id" from tbl; Id ---- 1 (1 row) Time: 78.231 ms [local]:5432 pg12@testdb=#
Don’t Do This
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/6906/viewspace-2660128/，如需转载，请注明出处，否则将追究法律责任。