Re: partitioning / rules - strange behavior - Mailing list pgsql-general

From Tomas Vondra
Subject Re: partitioning / rules - strange behavior
Date
Msg-id 45CA5063.7010405@fuzzy.cz
Whole thread Raw
In response to Re: partitioning / rules - strange behavior  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: partitioning / rules - strange behavior
List pgsql-general
>> But I don't understand why the nextval('sessions_id_seq') is evaluated
>> multiple times? Even when I do
>
> RULE expand like macros, so every expression passed in is simply copied
> to each place, leading to multiple evaluations.
>
> If you've played with the C preprocessor: that has the same basic
> problem.
>
> It's rather unexpected for novices, which is why triggers are usually
> recommended.

I wouldn't call myself a novice, but yes - this surprised me a little.
Now it seems so natural ... I think there should be a clear explanation
/ example in the docs about this - I've read the documentation on RULE
sytem several times and as far as I remember.

Anyway thanks to those helped me to solve this problem, now it works as
expected.

Tomas


pgsql-general by date:

Previous
From: rob_spellberg
Date:
Subject: a request for the 8.1.7 and 8.2.2 tarballs and the good reasons why
Next
From: Tomas Vondra
Date:
Subject: Re: partitioning / rules - strange behavior