| From: | Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | [PGSQL 8.2.x] INSERT+INSERT |
| Date: | 2007-06-21 09:56:05 |
| Message-ID: | 200706211156.05821.vincenzo.romano@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi all.
I'd like to do the following:
insert into t1
values (
'atextvalue',(
insert into t2
values ( 'somethingelse' )
returning theserial
)
)
;
that is, I first insert data into t2 getting back the newly created
serial values, then i insert this values in another table.
I get an error message:
ERROR: syntax error at or near "into"
referring to thwe second inner "into".
Is there a way to do this?
The inner insert...returning should be the "expression" to be used in
the outer insert.
My objective is to create an SQL script to load some 20+ million
records and avoiding function calls would save some time.
Thanks in advance.
--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PFC | 2007-06-21 09:56:44 | Re: Accent insensitive search |
| Previous Message | Richard Huxton | 2007-06-21 09:52:50 | Re: Recovery/Restore and Roll Forward Question. |