Code review for protransform patches.
Tom Lane <tgl@sss.pgh.pa.us>
Code review for protransform patches. Fix loss of previous expression-simplification work when a transform function fires: we must not simply revert to untransformed input tree. Instead build a dummy FuncExpr node to pass to the transform function. This has the additional advantage of providing a simpler, more uniform API for transform functions. Move documentation to a somewhat less buried spot, relocate some poorly-placed code, be more wary of null constants and invalid typmod values, add an opr_sanity check on protransform function signatures, and some other minor cosmetic adjustments. Note: although this patch touches pg_proc.h, no need for catversion bump, because the changes are cosmetic and don't actually change the intended catalog contents.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/catalogs.sgml | modified | +2 −1 |
| doc/src/sgml/xfunc.sgml | modified | +34 −0 |
| src/backend/nodes/nodeFuncs.c | modified | +28 −1 |
| src/backend/optimizer/util/clauses.c | modified | +50 −65 |
| src/backend/parser/parse_clause.c | modified | +0 −22 |
| src/backend/utils/adt/datetime.c | modified | +15 −14 |
| src/backend/utils/adt/numeric.c | modified | +11 −12 |
| src/backend/utils/adt/timestamp.c | modified | +11 −19 |
| src/backend/utils/adt/varbit.c | modified | +11 −12 |
| src/backend/utils/adt/varchar.c | modified | +13 −13 |
| src/include/catalog/pg_proc.h | modified | +12 −11 |
| src/include/nodes/nodeFuncs.h | modified | +1 −0 |
| src/include/parser/parse_clause.h | modified | +0 −2 |
| src/test/regress/expected/opr_sanity.out | modified | +10 −0 |
| src/test/regress/sql/opr_sanity.sql | modified | +7 −0 |