Re: [Bulk] Re: quoted identifier behaviour - Mailing list pgsql-general

From Scott Marlowe
Subject Re: [Bulk] Re: quoted identifier behaviour
Date
Msg-id 1173971564.12681.31.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: [Bulk] Re: quoted identifier behaviour  (Randall Smith <randall@tnr.cc>)
List pgsql-general
On Wed, 2007-03-14 at 17:33, Randall Smith wrote:
> Scott Marlowe wrote:
> > This whole discussion is reminding me of one of my personal mantras, and
> > that is that relying on "artifacts" of behaviour is generally a bad
> > idea.
> >
> > For instance, many databases accept != for not equal, but the sql
> > standard quite clearly says it's <>.
> >
> > If you're relying on case folding meaning that you don't have to
> > consistently use the same capitalization when referring to variables,
> > table names, people, or anything else, you're asking for trouble down
> > the line, and for little or no real gain today.
> >
> > I know that a lot of times we are stuck with some commercial package
> > that we can't do anything to fix, so I'm not aiming this comment at the
> > average dba, but at the developer.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >                http://archives.postgresql.org/
> >
>
> Yea, this is a commercial package, but it's actually doing it right.
> Since it doesn't know how a user will name a table or column, it always
> calls them as quoted strings in upper case which is standards compliant,
> but doesn't work with PG.  So if a user names a table 55 and mine, it
> calls "55 AND MINE" and for foo, it calls "FOO". Looks like they did it
> right to me.

No they did it wrong.  I can make a table in oracle like this:

create table "Mine" ("MyName" varchar(200), "id" int)

and it won't work with your application, because it's broken.  Assuming
that everything is in upper case is just as bad as assuming it's in
lower case.  You can't assume the case because the user could be quoting
the name when he creates the table.

The rule, for Oracle, PostgreSQL, etc is that if you use quotes to name
it, you use quotes to access it.

With that philosophy, Oracle and PostgreSQL work just fine.

If you ignore that simple rule, you will get yourself into a corner with
either database.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@postgresql.org so that your
       message can get through to the mailing list cleanly



pgsql-general by date:

Previous
From: "Jasbinder Singh Bali"
Date:
Subject: Re: Exception handling in plperl
Next
From: Scott Marlowe
Date:
Subject: Re: Lifecycle of PostgreSQL releases