fix_param_location-1.diff

text/plain

Filename: fix_param_location-1.diff
Type: text/plain
Part: 0
Message: Preserving param location

Patch

Format: unified
File+
src/backend/optimizer/util/clauses.c 6 1
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index b19380e1b1..beb0f99144 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -2444,6 +2444,7 @@ eval_const_expressions_mutator(Node *node,
 							int16		typLen;
 							bool		typByVal;
 							Datum		pval;
+							Const	   *con;
 
 							Assert(prm->ptype == param->paramtype);
 							get_typlenbyval(param->paramtype,
@@ -2452,13 +2453,17 @@ eval_const_expressions_mutator(Node *node,
 								pval = prm->value;
 							else
 								pval = datumCopy(prm->value, typByVal, typLen);
-							return (Node *) makeConst(param->paramtype,
+
+							con = makeConst(param->paramtype,
 													  param->paramtypmod,
 													  param->paramcollid,
 													  (int) typLen,
 													  pval,
 													  prm->isnull,
 													  typByVal);
+							con->location = param->location;
+
+							return (Node *) con;
 						}
 					}
 				}