From bfa4440ca5d948c4d4f0ab5bb82d433200c35288 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 25 Mar 2011 20:10:42 -0400 Subject: 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. --- src/backend/parser/parse_node.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/backend/parser/parse_node.c') diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 2c76c557ecc..07257accc82 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -347,6 +347,7 @@ transformArraySubscripts(ParseState *pstate, /* Make a constant 1 */ subexpr = (Node *) makeConst(INT4OID, -1, + InvalidOid, sizeof(int32), Int32GetDatum(1), false, @@ -526,6 +527,7 @@ make_const(ParseState *pstate, Value *value, int location) /* return a null const */ con = makeConst(UNKNOWNOID, -1, + InvalidOid, -2, (Datum) 0, true, @@ -540,6 +542,7 @@ make_const(ParseState *pstate, Value *value, int location) con = makeConst(typeid, -1, /* typmod -1 is OK for all cases */ + InvalidOid, /* all cases are uncollatable types */ typelen, val, false, -- cgit v1.2.3