On 5 March 2015 at 23:44, Peter Geoghegan <pg@heroku.com> wrote:
> On Wed, Mar 4, 2015 at 5:18 PM, Peter Geoghegan <pg@heroku.com> wrote:
>> Attached patch series forms what I'm calling V3.0 of the INSERT ... ON
>> CONFLICT IGNORE/UPDATE feature. (Sorry about all the threads. I feel
>> this development justifies a new thread, though.)
>
Hi,
I had a play with this, mainly looking at the interaction with RLS.
(Note there is some bitrot in gram.y that prevents the first patch
from applying cleanly to HEAD)
I tested using the attached script, and one test didn't behave as I
expected. I believe the following should have been a valid upsert
(following the update path) but actually it failed:
INSERT INTO t1 VALUES (4, 0) ON CONFLICT (a) UPDATE SET b = 1;
AFAICT, it is applying a WITH CHECK OPTION with qual "b > 0 AND a % 2
= 0" to the about-to-be-updated tuple (a=4, b=0), which is wrong
because the "b > 0" check (policy p3) should only be applied to the
post-update tuple.
Possibly I'm missing something though.
Regards,
Dean