Re: INSERT ... VALUES... with ORDER BY / LIMIT

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: INSERT ... VALUES... with ORDER BY / LIMIT
Дата
Msg-id 1285959229.28506.21.camel@jdavis-ux.asterdata.local
обсуждение исходный текст
Ответ на INSERT ... VALUES... with ORDER BY / LIMIT  (Hitoshi Harada <umi.tanuki@gmail.com>)
Ответы Re: INSERT ... VALUES... with ORDER BY / LIMIT  (Hitoshi Harada <umi.tanuki@gmail.com>)
Список pgsql-hackers
On Fri, 2010-10-01 at 18:52 +0900, Hitoshi Harada wrote:
> While tackling the top-level CTEs patch, I found that INSERT ...
> VALUES isn't aware of ORDER BY / LIMIT.
> 
> regression=# CREATE TABLE t1(x int);
> CREATE TABLE
> regression=# INSERT INTO t1 VALUES (1),(2),(3) LIMIT 1;
> INSERT 0 3

That looks like a bug to me. According to the documentation:
 "Within larger commands, VALUES is syntactically allowed anywhere  that SELECT is. Because it is treated like a SELECT
bythe grammar,   it is possible to use the ORDER BY, LIMIT..."
 
 -- http://www.postgresql.org/docs/9.0/static/sql-values.html

The doc for INSERT is a little less clear:
http://www.postgresql.org/docs/9.0/static/sql-insert.html

It explicitly makes room in the INSERT grammar for VALUES, but in that
branch of the grammar it doesn't make room for the ORDER BY, etc.

Regards,Jeff Davis



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: patch: tsearch - some memory diet
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: So git pull is shorthand for what exactly?