]> granicus.if.org Git - postgresql/commitdiff
Fix failure to propagate collation in negate_clause().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Mar 2011 22:44:47 +0000 (18:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Mar 2011 22:44:47 +0000 (18:44 -0400)
Turns out it was this, and not so much plpgsql, that was at fault in Stefan
Huehner's collation-error-in-a-trigger bug report of a couple weeks ago.

src/backend/optimizer/prep/prepqual.c

index fbd68097244129cb3be462674d7e9bbe5f3a1419..10e00d90ddac55f063718afd9d1bebf45f4cbe5e 100644 (file)
@@ -104,6 +104,8 @@ negate_clause(Node *node)
                                        newopexpr->opfuncid = InvalidOid;
                                        newopexpr->opresulttype = opexpr->opresulttype;
                                        newopexpr->opretset = opexpr->opretset;
+                                       newopexpr->opcollid = opexpr->opcollid;
+                                       newopexpr->inputcollid = opexpr->inputcollid;
                                        newopexpr->args = opexpr->args;
                                        newopexpr->location = opexpr->location;
                                        return (Node *) newopexpr;
@@ -126,6 +128,7 @@ negate_clause(Node *node)
                                        newopexpr->opno = negator;
                                        newopexpr->opfuncid = InvalidOid;
                                        newopexpr->useOr = !saopexpr->useOr;
+                                       newopexpr->inputcollid = saopexpr->inputcollid;
                                        newopexpr->args = saopexpr->args;
                                        newopexpr->location = saopexpr->location;
                                        return (Node *) newopexpr;