On 2015-05-28 18:31:56 -0700, Peter Geoghegan wrote:
> Subject: [PATCH 3/3] Fix bug in unique index inference
> 
> ON CONFLICT unique index inference had a thinko that could affect cases
> where the user-supplied inference clause required that an attribute
> match a particular (user named) collation and/or opclass.
> 
> Firstly, infer_collation_opclass_match() matched on opclass and/or
> collation.  Secondly, the attribute had to be in the list of attributes
> or expressions known to be in the definition of the index under
> consideration.  The second step wasn't correct though, because having
> some match doesn't necessarily mean that the second step found the same
> index attribute as the (collation/opclass wise) match from the first
> step.

Yes, makes sense.

> +             else
> +             {
> +                     Node       *nattExpr = list_nth(idxExprs, (natt - 1) - 
> nplain);
> +
> +                     /*
> +                      * Note that unlike routines like 
> match_index_to_operand(), we're
> +                      * unconcerned about RelabelType.  An exact match is 
> required.
> +                      */
> +                     if (equal(elem->expr, nattExpr))
> +                             return true;

Why is that?

Regads,

Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to