Re: column name is "LIMIT"

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: column name is "LIMIT"
Date: 2005-03-21 14:59:22
Message-ID: 423EE14A.5080202@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 3/14/2005 4:26 AM, Qingqing Zhou wrote:

> So is it to make SQL parser context-sensitive - say the parser will
> understand that in statement "SELECT * from LIMIT", LIMIT is just a table
> name, instead of keyword?

More or less, yes. To use a reserved keyword as an identifier (table or
column name), it must be enclosed in double quotes. Double quotes are
also used to make identifiers case sensitive. So

select someval, "SOMEVAL", "someVAL" from "user";

is a valid query retrieving 3 distinct columns from the table "user".
There is a builtin function quote_ident() in PostgreSQL that is supposed
to return a properly quoted string allowed as an identifier for whatever
name is passed in. But it fails to do so for all lower case names that
are reserved keywords.

The queries Slony executes on the replicas are constructed using that
quoting function, and therefore Slony fails to build valid SQL for
replicated table containing reserved keyword identifiers. One solution
would be to brute-force quote all identifiers in Slony ... not sure what
the side effects performance wise would be.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Zeki 2005-03-21 15:27:17 Re: BUG #1552: massive performance hit between 7.4 and 8.0.1
Previous Message Tambet Matiisen 2005-03-21 10:05:56 What about utility to calculate planner cost constants?