aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_target.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-09-06 17:31:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-09-06 17:31:58 +0000
commitf8942f4a15fa5baa51c52491147a1bb910532332 (patch)
treed8d7b6f9cb19ebbad98e8893abff208a42e492fb /src/backend/parser/parse_target.c
parent190df8a4cfc2a9df911f001b1601c4cc937d5a07 (diff)
downloadpostgresql-f8942f4a15fa5baa51c52491147a1bb910532332.tar.gz
postgresql-f8942f4a15fa5baa51c52491147a1bb910532332.zip
Make eval_const_expressions() preserve typmod when simplifying something like
null::char(3) to a simple Const node. (It already worked for non-null values, but not when we skipped evaluation of a strict coercion function.) This prevents loss of typmod knowledge in situations such as exhibited in bug #3598. Unfortunately there seems no good way to fix that bug in 8.1 and 8.2, because they simply don't carry a typmod for a plain Const node. In passing I made all the other callers of makeNullConst supply "real" typmod values too, though I think it probably doesn't matter anywhere else.
Diffstat (limited to 'src/backend/parser/parse_target.c')
-rw-r--r--src/backend/parser/parse_target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index cc4bc091d24..6623ac6ed33 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.154 2007/02/03 14:06:54 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.155 2007/09/06 17:31:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -393,7 +393,7 @@ transformAssignedExpr(ParseState *pstate,
* is not really a source value to work with. Insert a NULL
* constant as the source value.
*/
- colVar = (Node *) makeNullConst(attrtype);
+ colVar = (Node *) makeNullConst(attrtype, attrtypmod);
}
else
{