Missing table from in INSERT RETURNING

Поиск
Список
Период
Сортировка
От Rémi Cura
Тема Missing table from in INSERT RETURNING
Дата
Msg-id CAJvUf_v0G+8MzG8Dp7v7iizh00wb6gDCDZQmBY6jTPjhQRUohQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Missing table from in INSERT RETURNING  (John McKown <john.archie.mckown@gmail.com>)
Список pgsql-general
Hello dear list,
I would appreciate some help on a small matter that has been bothering me for a long time :


CREATE TABLE test_insert_returning( 
gid SERIAL
,some_value int 
);
WITH serie AS (
select s, s*10 as computing
from generate_series(1,10) as s 
)
INSERT INTO test_insert_returning (some_value)
SELECT computing
FROM serie
RETURNING gid, serie.s

doesn't work.

The only workaround I found was to create a plpgsql function that doesan idnividual insert
so that :
WITH serie AS (
select s, s*10 as computing
from generate_series(1,10) as s 
)
SELECT serie.s, my_inserting_function(computing)
FROM serie ;

But it is very annoying and potentially bad for performance because many insert may be fired.

Any solution?
(postgres 9.3)
Cheers,
Rémi-C

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Issue dumping schema using readonly user
Следующее
От: Guillaume Drolet
Дата:
Сообщение: Re: Starting new cluster from base backup