8.2: select from an INSERT returning?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: 8.2: select from an INSERT returning?
Date: 2006-09-20 16:42:51
Message-ID: 1158770571.30652.125.camel@dogma.v10.wvs
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was trying to use an INSERT ... RETURNING as a subselect in 8.2. Is
that possible?

jdavis=# create table foo(i int);
CREATE TABLE
jdavis=# insert into foo(i) values(1) returning i;
i
---
1
(1 row)

INSERT 0 1
jdavis=# select * from (insert into foo(i) values(1) returning i) t;
ERROR: syntax error at or near "into"
LINE 1: select * from (insert into foo(i) values(1) returning i) t;
^

If not, is there a reason it shouldn't be allowed, or is that a possible
feature for 8.3?

Also, why no GROUP BY or aggregate functions?

I was interested in using the RETURNING clause in place of using
PQcmdTuples() to get information about what was inserted. I don't think
there's any way for a function to modify what is returned by
PQcmdTuples, right?

Regards,
Jeff Davis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-09-20 17:41:11 Re: Problems converting between C string and Datum
Previous Message Jack Orenstein 2006-09-20 15:19:29 Problems converting between C string and Datum
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy