Re: column name is "LIMIT"

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: column name is "LIMIT"
Дата
Msg-id 423EE14A.5080202@Yahoo.com
обсуждение исходный текст
Ответ на Re: column name is "LIMIT"  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Ответы Re: column name is "LIMIT"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Tambet Matiisen"
Дата:
Сообщение: What about utility to calculate planner cost constants?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: column name is "LIMIT"