diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-25 20:10:42 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-25 20:10:42 -0400 |
commit | bfa4440ca5d948c4d4f0ab5bb82d433200c35288 (patch) | |
tree | 729b839f5f03c46773250ce3d33fc351f394e63e /src/backend/rewrite/rewriteManip.c | |
parent | c8e993503d0f1a0cb8f187a136fb64cead9ba591 (diff) | |
download | postgresql-bfa4440ca5d948c4d4f0ab5bb82d433200c35288.tar.gz postgresql-bfa4440ca5d948c4d4f0ab5bb82d433200c35288.zip |
Pass collation to makeConst() instead of looking it up internally.
In nearly all cases, the caller already knows the correct collation, and
in a number of places, the value the caller has handy is more correct than
the default for the type would be. (In particular, this patch makes it
significantly less likely that eval_const_expressions will result in
changing the exposed collation of an expression.) So an internal lookup
is both expensive and wrong.
Diffstat (limited to 'src/backend/rewrite/rewriteManip.c')
-rw-r--r-- | src/backend/rewrite/rewriteManip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index 49a6df0e807..d3985b2093e 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -1281,7 +1281,8 @@ ResolveNew_callback(Var *var, /* Otherwise replace unmatched var with a null */ /* need coerce_to_domain in case of NOT NULL domain constraint */ return coerce_to_domain((Node *) makeNullConst(var->vartype, - var->vartypmod), + var->vartypmod, + var->varcollid), InvalidOid, -1, var->vartype, COERCE_IMPLICIT_CAST, |