Re: How to find LIMIT in SQL standard

Поиск
Список
Период
Сортировка
От Gaetano Mendola
Тема Re: How to find LIMIT in SQL standard
Дата
Msg-id bkn72i$hvv$1@floppy.pyrenet.fr
обсуждение исходный текст
Ответ на How to find LIMIT in SQL standard  (Rory Campbell-Lange <rory@campbell-lange.net>)
Список pgsql-general
Rory Campbell-Lange wrote:

> Essentially the call (as defined below) asks for an update and adds a
> LIMIT parameter on the end of the UPDATE. (eg update where x=1 limit 1).
> Postgres doesn't like this and I assume it isn't SQL standards
> compliant and need to refer to this in my bug report.

As far as I know you can not specify a limit for update in Postgres,
at least not in that way.

if you want to do

UPDATE foo SET a='bar' where b LIMIT 1;

this is possible in Postgres doing:

UPDATE foo SET a = 'bar
WHERE foo.oid IN
( SELECT f.oid
   FROM foo f
   WHERE b
   LIMIT 1
);


This fail if the table are created without OID.


Regards
Gaetano Mendola


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

Предыдущее
От: victor silalahi
Дата:
Сообщение: DSN-Less
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: How to find LIMIT in SQL standard