Partitoning not working with RETURNING and INSERT/UPDATE

Поиск
Список
Период
Сортировка
От Frank Jördens
Тема Partitoning not working with RETURNING and INSERT/UPDATE
Дата
Msg-id 7d10d2df0902101955r341b0c25vf2f40055239aca36@mail.gmail.com
обсуждение исходный текст
Список pgsql-sql
I created a partitioned table and am now finding that it won't (at
least not trivially) support the RETURNING syntax with insert or
update:

If I take the trigger approach (as in the online manual), allowing for
RETURNING to work means that I have to let the BEFORE INSERT trigger
return the row rather than NULL, which means it'll get inserted into
the base table as well as the partition, and I'll end up with 2 rows
per insert.

If I try to define rules (very much like the example in the docs), I get:

-- snip --
woome=# INSERT INTO "userstats_profileview" ("viewer_id", "viewed_id")
VALUES (94039, 60701) RETURNING id;
ERROR:  cannot perform INSERT RETURNING on relation "userstats_profileview"
HINT:  You need an unconditional ON INSERT DO INSTEAD rule with a
RETURNING clause.
-- snap --

Is there any way to make this work?

Regards,

Frank


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

Предыдущее
От: "Bart van Houdt"
Дата:
Сообщение: RE: [SQL] Grass Root Protectionism
Следующее
От: Andreas
Дата:
Сообщение: Funtion to clean up strings?