how to insert multiple rows and get the ids back in a temp table (pgplsql)? - Mailing list pgsql-general

From Bret Green
Subject how to insert multiple rows and get the ids back in a temp table (pgplsql)?
Date
Msg-id 628416.19745.qm@web120415.mail.ne1.yahoo.com
Whole thread Raw
Responses Re: how to insert multiple rows and get the ids back in a temp table (pgplsql)?  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: how to insert multiple rows and get the ids back in a temp table (pgplsql)?  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general

how can I do the following in plpgsql?

insert multiple rows in a table

get the ids (serial) into a temp table (not the client)

 

for one row it will be like this

insert into mytable(mycolumn)values(123)returning id into some_variable;


now for multiple rows (using insert select) it will be like


insert into mytable(mycolumn)

select other_column from other_table

returning id into ???

 


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: unintuitive subquery record wrapping
Next
From: Thom Brown
Date:
Subject: Database not starting up for hot standby