Re: column name is "LIMIT" - Mailing list pgsql-performance

From Jan Wieck
Subject Re: column name is "LIMIT"
Date
Msg-id 423EE14A.5080202@Yahoo.com
Whole thread Raw
In response to Re: column name is "LIMIT"  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Responses Re: column name is "LIMIT"  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@Yahoo.com #

pgsql-performance by date:

Previous
From: "Tambet Matiisen"
Date:
Subject: What about utility to calculate planner cost constants?
Next
From: Tom Lane
Date:
Subject: Re: column name is "LIMIT"