From: | "Leon Mergen" <leon(at)solatis(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | INSERT..RETURNING on a partitioned table |
Date: | 2007-04-10 06:46:41 |
Message-ID: | 5eaaef180704092346r7ca5aeadm1d168479a0c0a7a6@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Klaas Dellschaft | 2007-04-10 07:33:38 | Re: Problem with copying data |
Previous Message | Jason Nerothin | 2007-04-10 05:09:44 | passing arrays to shared object functions |