Re: How to find LIMIT in SQL standard - Mailing list pgsql-general

From Gaetano Mendola
Subject Re: How to find LIMIT in SQL standard
Date
Msg-id bkn72i$hvv$1@floppy.pyrenet.fr
Whole thread Raw
In response to How to find LIMIT in SQL standard  (Rory Campbell-Lange <rory@campbell-lange.net>)
List 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 by date:

Previous
From: victor silalahi
Date:
Subject: DSN-Less
Next
From: Peter Eisentraut
Date:
Subject: Re: How to find LIMIT in SQL standard