fluca1978@xxxxxxxxxxx wrote:
first of all I'm not expressing any critique against the use of quotes for identifier expressed using camel case. However a lot of new postgresql users seems to be unhappy with the use of quotes for camel case identifiers, so I'd like to know what is the rationale behind it. I mean, is a feature of the partser or is a need for it to work? Anyone can point me to an explaination?
The need for quoting and use of CamelCase are only vaguely related to one another. There are situations other than CamelCase where quotes are needed, and using CamelCase doesn't necessarily require quotes.
If you follow the end of the documentation at http://www.postgresql.org/docs/9.0/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS you'll find this explanation of what the quoting issue is all about:
Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other. (The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.)
So saying you're unhappy with the need for quoting of mixed-case items isn't going to get you very far, as the behavior here is all tied up with the trivia of the SQL spec. The specification intends that anything other than all upper-case naming requires quoting, and PostgreSQL turns that around to say that everything goes to lower-case by default. It's actually possible to leave out the quoting if you really want to, but as advised here you have to be consistent about it. Once you've created something with a fully quoted name, instead of letting it "fold" the name to all lower-case, you must continue to reference it that way in the future. There's nothing stopping you from just never quoting anything though.
-- Greg Smith 2ndQuadrant US greg@xxxxxxxxxxxxxxx Baltimore, MD Comprehensive and Customized PostgreSQL Training Classes: http://www.2ndquadrant.us/postgresql-training/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general