[PGSQL 8.2.x] INSERT+INSERT - Mailing list pgsql-general

From Vincenzo Romano
Subject [PGSQL 8.2.x] INSERT+INSERT
Date
Msg-id 200706211156.05821.vincenzo.romano@gmail.com
Whole thread Raw
Responses Re: [PGSQL 8.2.x] INSERT+INSERT  ("Dawid Kuroczko" <qnex42@gmail.com>)
List 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]

pgsql-general by date:

Previous
From: PFC
Date:
Subject: Re: Accent insensitive search
Next
From: Bruce McAlister
Date:
Subject: Re: Recovery/Restore and Roll Forward Question.