Re: Quoting table/column names vs performance

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Quoting table/column names vs performance
Date: 2008-04-09 18:26:50
Message-ID: 20080409202650.43349558@webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 9 Apr 2008 19:11:57 +0200
Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> wrote:

> On Apr 9, 2008, at 5:27 PM, Jozef Ševčík wrote:
> > In MSSQL I had something like:
> > SELECT Column1,Column2 from MyTable
> >
> > In PgSQL I write:
> > SELECT “Column1”, “Column2” from “MyTable”
> >
> > Which is fine and working, I have no doubt about it. I’m just
> > guessing if this does not affect performance
> > in any way.
>
> What are you trying to fix that you don't just write SELECT
> Column1,Column2 from MyTable ?
> Postgres understands that fine, why do you want to quote those
> identifiers? Maybe your application code is case-sensitive with
> regards to column (and maybe table) names?

There are a couple of small gotcha.

eg.

- PHP actually is case sensitive so:

$row['MyRow'] != $row['myrow']

If you used camel case in pg without quotes it will be a pain.

- Some pg functions aren't case-proof eg. pg_get_serial_sequence

I'm thinking to write a script to quote all identifiers... but I'm
worried it will look to much as a parser rather than a simple sed
script since I got trapped by the above too.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2008-04-09 18:56:48 Re: Disable Triggers
Previous Message Craig Ringer 2008-04-09 18:04:19 Re: connecting VB to postgreSQL