insert into t1 (delete from t0 returning *)

From: "Matthew Dennis" <mdennis(at)merfer(dot)net>
To: PGSQL <pgsql-general(at)postgresql(dot)org>
Subject: insert into t1 (delete from t0 returning *)
Date: 2007-12-17 23:56:15
Message-ID: e94d85500712171556m5cd2489bi9565c5f757f5756e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

in 8.3beta3

create table t0(c1 int);
create table t1(c1 int);

insert into t0 values (1);
insert into t0 values (2);
insert into t0 values (3);

If I execute "delete from t0 returning *" it deletes the rows and returns
the deleted rows. I could insert all those rows into t1 by doing "insert
into t1 (select * from t0)". I would expect to be able to do the same with
"returning *". In particular, I would expect "insert into t1 (delete from
t0 returning *)" to delete the rows from t0 and insert them into t1 but I
get a syntax error - is that expected?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-12-18 01:17:12 Re: insert into t1 (delete from t0 returning *)
Previous Message Adrian Klaver 2007-12-17 23:34:07 Re: spreadsheet interface