Re: Using results from RETURNING

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Shak <Shak(at)shak(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using results from RETURNING
Date: 2009-06-06 09:05:18
Message-ID: 4A2A314E.80605@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Shak wrote:

> Something like:
>
> SELECT COUNT(*) FROM (DELETE FROM a RETURNING *) ;
>
> sounds reasonable but results in a syntax error. I am able to return
> single results into a variable or record, but not more than one result.

Subqueries using DELETE ... RETURNING or UPDATE ... RETURNING are not
yet supported. Unfortunately. It'd be extremely useful in some
situations, but it sounds like there are plenty of issues that make it
less than trivial.

> I could use a SELECT ... FOR UPDATE in the meantime, I just wanted to
> know what the use of RETURNING * was if you can't do anything with the
> results.

You can use them in most situations other than subqueries. PL/PgSQL
SELECT INTO, returning to the client, etc. Really handy.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-06-06 09:10:07 Re: Creating schema, database, or table in different folder.
Previous Message Jean-Gérard Pailloncy 2009-06-06 08:44:26 Event System