how to insert multiple rows and get the ids back in a temp table (pgplsql)?

Поиск
Список
Период
Сортировка
От Bret Green
Тема how to insert multiple rows and get the ids back in a temp table (pgplsql)?
Дата
Msg-id 628416.19745.qm@web120415.mail.ne1.yahoo.com
обсуждение исходный текст
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: unintuitive subquery record wrapping
Следующее
От: Thom Brown
Дата:
Сообщение: Database not starting up for hot standby