summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_coerce.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-03-25 20:10:42 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-03-25 20:10:42 -0400
commitbfa4440ca5d948c4d4f0ab5bb82d433200c35288 (patch)
tree729b839f5f03c46773250ce3d33fc351f394e63e /src/backend/parser/parse_coerce.c
parentc8e993503d0f1a0cb8f187a136fb64cead9ba591 (diff)
downloadpostgresql-bfa4440ca5d948c4d4f0ab5bb82d433200c35288.tar.gz
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/parser/parse_coerce.c')
-rw-r--r--src/backend/parser/parse_coerce.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 9b59b03297..cc03f9f48e 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -753,6 +753,7 @@ build_coercion_expression(Node *node,
/* Pass target typmod as an int4 constant */
cons = makeConst(INT4OID,
-1,
+ InvalidOid,
sizeof(int32),
Int32GetDatum(targetTypMod),
false,
@@ -766,6 +767,7 @@ build_coercion_expression(Node *node,
/* Pass it a boolean isExplicit parameter, too */
cons = makeConst(BOOLOID,
-1,
+ InvalidOid,
sizeof(bool),
BoolGetDatum(isExplicit),
false,
@@ -890,7 +892,8 @@ coerce_record_to_complex(ParseState *pstate, Node *node,
* can't use atttypid here, but it doesn't really matter what type
* the Const claims to be.
*/
- newargs = lappend(newargs, makeNullConst(INT4OID, -1));
+ newargs = lappend(newargs,
+ makeNullConst(INT4OID, -1, InvalidOid));
continue;
}