pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <JanWieck@Yahoo.com>
To: Qingqing Zhou <zhouqq@cs.toronto.edu>
Cc: pgsql-performance@postgresql.org
Subject: Re: column name is "LIMIT"
Date: Mon, 21 Mar 2005 09:59:22 -0500
Message-ID: <423EE14A.5080202@Yahoo.com> (raw)
In-Reply-To: <d13llj$1cfb$1@news.hub.org>
References: <674d1f8a0503132314754df153@mail.gmail.com>
	<200503141825.22827.mr-russ@pws.com.au>
	<674d1f8a05031400482c413087@mail.gmail.com>
	<42355185.3070803@familyhealth.com.au>
	<d13llj$1cfb$1@news.hub.org>

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 #



view thread (13+ messages)  latest in thread

Message-ID: <423EE14A.5080202@Yahoo.com>
Permalink:  ../423EE14A.5080202@Yahoo.com/
Also on:    postgresql.org/message-id/423EE14A.5080202@Yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: JanWieck@Yahoo.com, zhouqq@cs.toronto.edu
  Subject: Re: column name is "LIMIT"
  In-Reply-To: <423EE14A.5080202@Yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox