Make eval_const_expressions() preserve typmod when simplifying something like
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/tablecmds.c | modified | +7 −4 |
| src/backend/executor/execQual.c | modified | +2 −2 |
| src/backend/nodes/makefuncs.c | modified | +6 −5 |
| src/backend/optimizer/util/clauses.c | modified | +3 −3 |
| src/backend/parser/parse_coerce.c | modified | +2 −2 |
| src/backend/parser/parse_relation.c | modified | +2 −2 |
| src/backend/parser/parse_target.c | modified | +2 −2 |
| src/backend/rewrite/rewriteHandler.c | modified | +2 −2 |
| src/backend/rewrite/rewriteManip.c | modified | +3 −2 |
| src/include/nodes/makefuncs.h | modified | +2 −2 |