From: | Kevin Crain <kevin(dot)crain1(at)gmail(dot)com> |
---|---|
To: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Re: Order of evaluation in triggers for checks on inherited table partitions |
Date: | 2011-05-31 13:40:19 |
Message-ID: | BANLkTi=bzsS1+BDjYmCJ_+U68HgNMipXmw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Can procedural languages be used in rules? I didn't see any examples
in the documentation that suggested something like this could be done
using rules.
--Kevin Crain
On Mon, May 30, 2011 at 2:21 AM, Jasen Betts <jasen(at)xnet(dot)co(dot)nz> wrote:
> On 2011-05-27, Kevin Crain <kevin(dot)crain1(at)gmail(dot)com> wrote:
>> I am trying to create a trigger on updates to a table that is
>> partitioned. The child tables are partitioned by month and include
>> checks on a timestamp field.
>
>> However when I try to update an existing record with a
>> timestamp that would place it in a child table different from the
>> child table it is in I get an error due to the check on the child
>> table it is currently in. My best guess as to what is happening is
>> that the trigger is evaluating the check before it evaluates the
>> trigger function and thus cannot tell that the update to the original
>> table should never take place. I have included an example below. The
>> error that results is "new row for relation "t_foo_2011_6" violates
>> check constraint "t_foo_2011_6_f_timestamp_check""
>
> the problem is the check is running before the trigger.
> perhaps you can use a rule instead of a trigger?
>
> --
> ⚂⚃ 100% natural
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Crain | 2011-05-31 14:46:34 | Re: Re: Order of evaluation in triggers for checks on inherited table partitions |
Previous Message | Rob Sargent | 2011-05-30 14:45:26 | Re: Function to total reset a schema |