When I insert a record I need to return the inserted id by RETURNING
. The problem is that the table is partitioned and in partitioned table I can't use RETURNING
. I run multiple queries at once so I'm in dire need of RETURNING
. Is there a way to accomplish this?
|
||||
|
Assuming a parent's table like this:
Whether you're using a rule or a trigger to divert the INSERTs into the child tables, immediately after the INSERT you may use:
to get the last |
|||
|
Without having an overview of how you are currently managing your partitioned tables, it is relatively difficult to assess what you can do to circumvent this limitation. Assuming you are using a trigger paradigm, in order to get However, this means a double write occurs, so an Here is the full SQL Fiddle to show what I have described in action. Note that the |
|||
|