Search Postgresql Archives

INSERT..RETURNING on a partitioned table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm attempting to convert a big table into smaller tables; I currently
do a lot of INSERT .. RETURNING calls on the big table, which works
perfectly.

To convert the table into smaller tables, I have set up a test case of
3 tables, based on a 'CHECK ( hashtext(field) % 2 ) = -1' (or 0 or 1).
Now, even this works perfectly - data is inserted into the correct
table according to this value, and 'SET constraint_exclusion TO on'
even makes the SELECT () calls work properly.

However, I'm not stuck with my INSERT .. RETURNING: basically, I have
three conditional rules at the moment, and need to make these rules
return the ID of the inserted row. But postgres tells me this:

'ERROR:  RETURNING lists are not supported in conditional rules'

So my question is, is there any way that postgres supports INSERT ..
RETURNING with partitioned tables, where the subtable to insert to is
not know at application level ? I know I could write a stored
procedure for this, which SELECT ()s the id from a subtable after it
has been INSERTed, but this will put more stress on the database
server, and it sounds silly that INSERT .. RETURNING would not be
supported in my use case.

Any ideas/suggestions ? Thanks in advance!

Regards,

Leon Mergen


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux