diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/opr_sanity.out | 8 | ||||
| -rw-r--r-- | src/test/regress/sql/opr_sanity.sql | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 4e2c76de5c2..b76cc695f44 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -239,11 +239,17 @@ WHERE castsource = casttarget OR castsource = 0 OR casttarget = 0 -- Look for cast functions that don't have the right signature. The -- argument and result types in pg_proc must be the same as, or binary -- compatible with, what it says in pg_cast. +-- As a special case, we allow casts from CHAR(n) that use functions +-- declared to take TEXT. This does not pass the binary-coercibility test +-- because CHAR(n)-to-TEXT normally invokes rtrim(). However, the results +-- are the same, so long as the function is one that ignores trailing blanks. SELECT c.* FROM pg_cast c, pg_proc p WHERE c.castfunc = p.oid AND (p.pronargs <> 1 - OR NOT binary_coercible(c.castsource, p.proargtypes[0]) + OR NOT (binary_coercible(c.castsource, p.proargtypes[0]) + OR (c.castsource = 'character'::regtype AND + p.proargtypes[0] = 'text'::regtype)) OR NOT binary_coercible(p.prorettype, c.casttarget)); castsource | casttarget | castfunc | castcontext ------------+------------+----------+------------- diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 448f3ff0c5b..82a294db6d6 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -196,12 +196,18 @@ WHERE castsource = casttarget OR castsource = 0 OR casttarget = 0 -- Look for cast functions that don't have the right signature. The -- argument and result types in pg_proc must be the same as, or binary -- compatible with, what it says in pg_cast. +-- As a special case, we allow casts from CHAR(n) that use functions +-- declared to take TEXT. This does not pass the binary-coercibility test +-- because CHAR(n)-to-TEXT normally invokes rtrim(). However, the results +-- are the same, so long as the function is one that ignores trailing blanks. SELECT c.* FROM pg_cast c, pg_proc p WHERE c.castfunc = p.oid AND (p.pronargs <> 1 - OR NOT binary_coercible(c.castsource, p.proargtypes[0]) + OR NOT (binary_coercible(c.castsource, p.proargtypes[0]) + OR (c.castsource = 'character'::regtype AND + p.proargtypes[0] = 'text'::regtype)) OR NOT binary_coercible(p.prorettype, c.casttarget)); -- Look for binary compatible casts that do not have the reverse |
