Re: default child of partition master - Mailing list pgsql-hackers

From Gene
Subject Re: default child of partition master
Date
Msg-id 430d92a20608200958q33d4ca0epaaeafe88747a8c20@mail.gmail.com
Whole thread Raw
In response to Re: default child of partition master  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: default child of partition master
List pgsql-hackers
Keep in mind if you have multiple rules for a master table, it won't return the number of affected rows as you might expect. This screws up Hibernate which I'm using for my application. It checks the return value to make sure it was inserted properly. Luckily I only need one rule which puts it into the "current" child table (im partitioning on current timestamp). I suppose I could get around this by using a stored procedure or something but that would not be as portable. I'm looking forward to future versions of PG which automate more of the partitioning features :) keep up the good work!

Gene

On 8/20/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"April Lorenzen" <outboundindex@gmail.com> writes:
> My suggestion is to allow specifying a default destination table in
> the master partition table definition. This default destination table
> could be changed with ALTER TABLE.

The recommended way to do this is with an ON INSERT DO INSTEAD rule
on the master table.  The advantage of using rules is that you can have
several conditional rules to ensure that insertions go into the right
sub-tables, whereas a default would likely just fail :-(

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



--
Eugene Hart

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: default child of partition master
Next
From: Andreas Pflug
Date:
Subject: Re: pg_dump versus SERIAL, round N