Make eval_const_expressions() preserve typmod when simplifying something like
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Sep 2007 17:31:58 +0000 (17:31 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Sep 2007 17:31:58 +0000 (17:31 +0000)
commitf8942f4a15fa5baa51c52491147a1bb910532332
treed8d7b6f9cb19ebbad98e8893abff208a42e492fb
parent190df8a4cfc2a9df911f001b1601c4cc937d5a07
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.
src/backend/commands/tablecmds.c
src/backend/executor/execQual.c
src/backend/nodes/makefuncs.c
src/backend/optimizer/util/clauses.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/include/nodes/makefuncs.h