postgres.git / summary / log / commit / refs

commit    1afcf6aed73997c8beb340195a37cf5939c9eb2e
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Sun Feb 10 02:02:06 2019 +0000
First released in: 12.0, 9.5.16, 9.6.12, 10.7, 11.2

    Solve cross-version-upgrade testing problem induced by 1fb57af92.
    
    Renaming varchar_transform to varchar_support had a side effect
    I hadn't foreseen: the core regression tests leave around a
    transform object that relies on that function, so the name
    change breaks cross-version upgrade tests, because the name
    used in the older branches doesn't match.
    
    Since the dependency on varchar_transform was chosen with the
    aid of a dartboard anyway (it would surely not work as a
    language transform support function), fix by just choosing
    a different random builtin function with the right signature.
    Also add some comments explaining why this isn't horribly unsafe.
    
    I chose to make the same substitution in a couple of other
    copied-and-pasted test cases, for consistency, though those
    aren't directly contributing to the testing problem.
    
    Per buildfarm.  Back-patch, else it doesn't fix the problem.


src/test/modules/test_ddl_deparse/expected/create_transform.out | 6 ++++-- src/test/modules/test_ddl_deparse/sql/create_transform.sql | 6 ++++-- src/test/regress/expected/object_address.out | 4 +++- src/test/regress/sql/object_address.sql | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/test/modules/test_ddl_deparse/expected/create_transform.out b/src/test/modules/test_ddl_deparse/expected/create_transform.out index 0d1cc360f4e..5066051fca1 100644 --- a/src/test/modules/test_ddl_deparse/expected/create_transform.out +++ b/src/test/modules/test_ddl_deparse/expected/create_transform.out @@ -5,9 +5,11 @@ -- The function FROM SQL should have internal as single argument as well -- as return type. The function TO SQL should have as single argument -- internal and as return argument the datatype of the transform done. --- pl/plpgsql does not authorize the use of internal as data type. +-- We choose some random built-in functions that have the right signature. +-- This won't actually be used, because the SQL function language +-- doesn't implement transforms (there would be no point). CREATE TRANSFORM FOR int LANGUAGE SQL ( - FROM SQL WITH FUNCTION varchar_transform(internal), + FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal)); NOTICE: DDL test: type simple, tag CREATE TRANSFORM DROP TRANSFORM FOR int LANGUAGE SQL; diff --git a/src/test/modules/test_ddl_deparse/sql/create_transform.sql b/src/test/modules/test_ddl_deparse/sql/create_transform.sql index 096870233f8..970d89e03dc 100644 --- a/src/test/modules/test_ddl_deparse/sql/create_transform.sql +++ b/src/test/modules/test_ddl_deparse/sql/create_transform.sql @@ -6,9 +6,11 @@ -- The function FROM SQL should have internal as single argument as well -- as return type. The function TO SQL should have as single argument -- internal and as return argument the datatype of the transform done. --- pl/plpgsql does not authorize the use of internal as data type. +-- We choose some random built-in functions that have the right signature. +-- This won't actually be used, because the SQL function language +-- doesn't implement transforms (there would be no point). CREATE TRANSFORM FOR int LANGUAGE SQL ( - FROM SQL WITH FUNCTION varchar_transform(internal), + FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal)); DROP TRANSFORM FOR int LANGUAGE SQL; diff --git a/src/test/regress/expected/object_address.out b/src/test/regress/expected/object_address.out index 191d2fb6fdc..e5064cdea97 100644 --- a/src/test/regress/expected/object_address.out +++ b/src/test/regress/expected/object_address.out @@ -32,8 +32,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw; CREATE USER MAPPING FOR regtest_addr_user SERVER "integer"; ALTER DEFAULT PRIVILEGES FOR ROLE regtest_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regtest_addr_user; ALTER DEFAULT PRIVILEGES FOR ROLE regtest_addr_user REVOKE DELETE ON TABLES FROM regtest_addr_user; +-- this transform would be quite unsafe to leave lying around, +-- except that the SQL language pays no attention to transforms: CREATE TRANSFORM FOR int LANGUAGE SQL ( - FROM SQL WITH FUNCTION varchar_transform(internal), + FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal)); -- test some error cases SELECT pg_get_object_address('stone', '{}', '{}'); diff --git a/src/test/regress/sql/object_address.sql b/src/test/regress/sql/object_address.sql index 3e792ef849c..c0692873156 100644 --- a/src/test/regress/sql/object_address.sql +++ b/src/test/regress/sql/object_address.sql @@ -36,8 +36,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw; CREATE USER MAPPING FOR regtest_addr_user SERVER "integer"; ALTER DEFAULT PRIVILEGES FOR ROLE regtest_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regtest_addr_user; ALTER DEFAULT PRIVILEGES FOR ROLE regtest_addr_user REVOKE DELETE ON TABLES FROM regtest_addr_user; +-- this transform would be quite unsafe to leave lying around, +-- except that the SQL language pays no attention to transforms: CREATE TRANSFORM FOR int LANGUAGE SQL ( - FROM SQL WITH FUNCTION varchar_transform(internal), + FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal)); -- test some error cases [parent: 2c8332177137]