Re: BUG #5308: How to disable Case sensitivity on naming identifiers

From: Chris Travers <chris(at)metatrontech(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kelly SACAULT <kelly(dot)sacault(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5308: How to disable Case sensitivity on naming identifiers
Date: 2010-02-03 19:36:51
Message-ID: 5ed37b141002031136q68e8b966va423a9017caaf23e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Feb 3, 2010 at 11:30 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> 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.)
>
> You may not like the current behavior (that's up to you), but I don't
> believe there's any problem with how it's documented.

There might actually be two reasons to document the folding-to-lower though:

1) The SQL standards mandate folding to upper instead, so this is a
deviation from the standard (a good one IMO), but it might be useful
to highlight it for the reader esp. since it will hit those trying to
support multiple databases.

2) While I doubt that too many people get stuck on that (I did....
for all of 30 seconds), more clarity might be helpful for individuals
just starting to pick up PostgreSQL.

I don't like the proposed wording though. I would suggest something more like:
"Unless double-quoted, all identifiers are folded to lower case,
making comparisons generally case insensitive. The SQL standard
mandates folding identifiers to upper case, but the consensus among
the PostgreSQL development team is that folding to lower case is
better. If double-quotes are not used ever, or are used consistently
throughout the application, this poses no compatibility problems in
terms of SQL queries."

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-02-03 19:37:07 Re: BUG #5308: How to disable Case sensitivity on naming identifiers
Previous Message Robert Haas 2010-02-03 19:30:06 Re: BUG #5308: How to disable Case sensitivity on naming identifiers