diff options
| author | Tom Lane | 2011-03-26 00:10:42 +0000 |
|---|---|---|
| committer | Tom Lane | 2011-03-26 00:10:42 +0000 |
| commit | bfa4440ca5d948c4d4f0ab5bb82d433200c35288 (patch) | |
| tree | 729b839f5f03c46773250ce3d33fc351f394e63e /src/backend/rewrite/rewriteHandler.c | |
| parent | c8e993503d0f1a0cb8f187a136fb64cead9ba591 (diff) | |
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/rewriteHandler.c')
| -rw-r--r-- | src/backend/rewrite/rewriteHandler.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index 87d39174a44..a695b012399 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -208,7 +208,7 @@ AcquireRewriteLocks(Query *parsetree, bool forUpdatePushedDown) * now-dropped type OID, but it doesn't really * matter what type the Const claims to be. */ - aliasvar = (Var *) makeNullConst(INT4OID, -1); + aliasvar = (Var *) makeNullConst(INT4OID, -1, InvalidOid); } } newaliasvars = lappend(newaliasvars, aliasvar); @@ -719,6 +719,7 @@ rewriteTargetListIU(Query *parsetree, Relation target_relation, { new_expr = (Node *) makeConst(att_tup->atttypid, -1, + att_tup->attcollation, att_tup->attlen, (Datum) 0, true, /* isnull */ @@ -1082,6 +1083,7 @@ rewriteValuesRTE(RangeTblEntry *rte, Relation target_relation, List *attrnos) { new_expr = (Node *) makeConst(att_tup->atttypid, -1, + att_tup->attcollation, att_tup->attlen, (Datum) 0, true, /* isnull */ |
