Re: How to find LIMIT in SQL standard

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to find LIMIT in SQL standard
Date: 2003-09-22 14:11:42
Message-ID: bkn72i$hvv$1@floppy.pyrenet.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew L. Gould 2003-09-22 14:24:12 Re: OT: HEADS-UP: viral storm out there
Previous Message Robert Treat 2003-09-22 14:05:37 Re: OT: HEADS-UP: viral storm out there