diff options
| author | Tom Lane | 2012-03-23 21:29:57 +0000 |
|---|---|---|
| committer | Tom Lane | 2012-03-23 21:29:57 +0000 |
| commit | 0339047bc93147c1c6f78f867ae6b0c215406235 (patch) | |
| tree | 116a4cd10a9eb1b0b6beb4cf871bc126c504572a /src/test | |
| parent | e08b4101e1daa2f4e6644330918177a10cac0aab (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/opr_sanity.out | 10 | ||||
| -rw-r--r-- | src/test/regress/sql/opr_sanity.sql | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 7815b0d7be4..110ea4111f9 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -330,6 +330,16 @@ WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND -----+--------- (0 rows) +-- Check for protransform functions with the wrong signature +SELECT p1.oid, p1.proname, p2.oid, p2.proname +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p2.oid = p1.protransform AND + (p2.prorettype != 'internal'::regtype OR p2.proretset OR p2.pronargs != 1 + OR p2.proargtypes[0] != 'internal'::regtype); + oid | proname | oid | proname +-----+---------+-----+--------- +(0 rows) + -- Insist that all built-in pg_proc entries have descriptions SELECT p1.oid, p1.proname FROM pg_proc as p1 LEFT JOIN pg_description as d diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 3ed6366bfc0..a3be0c1114f 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -256,6 +256,13 @@ FROM pg_proc as p1 WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND array_length(proargmodes,1) <> array_length(proargnames,1); +-- Check for protransform functions with the wrong signature +SELECT p1.oid, p1.proname, p2.oid, p2.proname +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p2.oid = p1.protransform AND + (p2.prorettype != 'internal'::regtype OR p2.proretset OR p2.pronargs != 1 + OR p2.proargtypes[0] != 'internal'::regtype); + -- Insist that all built-in pg_proc entries have descriptions SELECT p1.oid, p1.proname FROM pg_proc as p1 LEFT JOIN pg_description as d |
