Thread: Partitioning triggers doc patch
Attached is a doc patch based on a suggestion by Rural Hunter to address something he found confusing while setting up partitioning. Original thread is here: http://archives.postgresql.org/pgsql-admin/2012-03/msg00066.php -Kevin
Attachment
On Mon, Mar 12, 2012 at 10:41 AM, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote: > Attached is a doc patch based on a suggestion by Rural Hunter to > address something he found confusing while setting up partitioning. > > Original thread is here: > > http://archives.postgresql.org/pgsql-admin/2012-03/msg00066.php > you can create trigger that execute before the trigger that redirect to the partition, for example to stamp the time or the user... so it should state something like i said about constraints """ Do not define any check constraints on this table, unless you intend them to be applied equally to all partitions. """ -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
Jaime Casanova <jaime@2ndquadrant.com> wrote: > On Mon, Mar 12, 2012 at 10:41 AM, Kevin Grittner > <Kevin.Grittner@wicourts.gov> wrote: >> Attached is a doc patch based on a suggestion by Rural Hunter to >> address something he found confusing while setting up >> partitioning. >> >> Original thread is here: >> >> http://archives.postgresql.org/pgsql-admin/2012-03/msg00066.php >> > > you can create trigger that execute before the trigger that > redirect to the partition, for example to stamp the time or the > user... so it should state something like i said about constraints > > """ > Do not define any check constraints on this table, unless you > intend them to be applied equally to all partitions. > """ Yeah, I thought about that issue, but the problem is that the rule or trigger that routes the operation to another partition might prevent the trigger from firing at all. I figured that if I went as far as what you describe, I would need to get into those timing issues, too; and I wasn't sure whether that might be "too much information" for that particular spot. But if you think we should go there, I could draft something which pointed out that an AFTER trigger is never useful and that a BEFORE trigger to enforce things globally must sort ahead of the "routing" trigger, and should not be used at all if a RULE is used to route operations to the partitions. Do we really want to get into all that in the middle of step-by-step instructions for the simple case? -Kevin
On Mon, Mar 12, 2012 at 12:39 PM, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote: > > Do we really want to get into all that in the middle of step-by-step > instructions for the simple case? > is there any other place we can add a more detailed explanation? so from your text after saying "usually there is no reason for" you can add a parentesis saying "more info in <link>" -- Jaime Casanova www.2ndQuadrant.com Professional PostgreSQL: Soporte 24x7 y capacitación
Jaime Casanova <jaime@2ndquadrant.com> wrote: > is there any other place we can add a more detailed explanation? > so from your text after saying "usually there is no reason for" > you can add a parentesis saying "more info in <link>" Sure, I'll look around for a good spot. -Kevin