Re: rationale behind quotes for camel case?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: fluca1978(at)infinito(dot)it
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: rationale behind quotes for camel case?
Date: 2011-06-28 13:43:58
Message-ID: BANLkTintjDtU-f8QeMTp5hSgLSdhZOt01A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 28, 2011 at 4:12 AM, <fluca1978(at)infinito(dot)it> wrote:
> Hi all,
> 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.

A few reasons:
*) aesthetics: given two queries that express the same thing, I'd
prefer the one with no " vs lots of ". Quoted identifiers do not
increase code clarity nor provide any technical benefit beyond being
able to mix identifiers by case, which most would agree is a terrible
idea.
*) once you decide to quote your identifiers like that, you have to
always do it. not just formal code, but queries in psql, etc. having
to type it out all the time is time consuming and distracting. (by the
way, I switched to lower case keywords a long time ago on similar
grounds)
*) lousy tools: sooner or later you may bump into a tool that
generates sql improperly without the quoted identifiers.

The rebuttal to the above points is that the problem with not quoting
is that your identifiers are folded to lower case on the server which
can make them difficult to read in psql, pgadmin, etc. when outputted.
This is true and I consequently use underscores to break up words in
my personal style (order_number, not OrderNumber), avoiding that
problem. Some people don't like it, but it is the easiest to type,
the most tool friendly, and most regular.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2011-06-28 14:11:14 Re: rationale behind quotes for camel case?
Previous Message John R Pierce 2011-06-28 11:00:42 Re: rationale behind quotes for camel case?