]> granicus.if.org Git - postgresql/commitdiff
Solve cross-version-upgrade testing problem induced by 1fb57af92.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Feb 2019 02:02:06 +0000 (21:02 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Feb 2019 02:02:06 +0000 (21:02 -0500)
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/bin/pg_dump/t/002_pg_dump.pl
src/test/modules/test_ddl_deparse/expected/create_transform.out
src/test/modules/test_ddl_deparse/sql/create_transform.sql
src/test/regress/expected/object_address.out
src/test/regress/sql/object_address.sql

index bb4ae9fde25d168f7d7030158e589c9fad8597ba..0233fcb47ff1eac93f6c01a4ecb571551757b5b4 100644 (file)
@@ -1897,9 +1897,9 @@ my %tests = (
        'CREATE TRANSFORM FOR int' => {
                create_order => 34,
                create_sql =>
-                 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_support(internal), TO SQL WITH FUNCTION int4recv(internal));',
+                 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal));',
                regexp =>
-                 qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog\.varchar_support\(internal\), TO SQL WITH FUNCTION pg_catalog\.int4recv\(internal\)\);/m,
+                 qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog\.prsd_lextype\(internal\), TO SQL WITH FUNCTION pg_catalog\.int4recv\(internal\)\);/m,
                like => { %full_runs, section_pre_data => 1, },
        },
 
index da7fea2d091da0204447e0a139392b543a958e42..5066051fca1ec089a9505df905230021db3171a9 100644 (file)
@@ -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_support(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;
index 132fc5af04990f0eb146efc9bc9346f792788d6d..970d89e03dc40831c026cdb697f016c2ee0c889d 100644 (file)
@@ -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_support(internal),
+    FROM SQL WITH FUNCTION prsd_lextype(internal),
     TO SQL WITH FUNCTION int4recv(internal));
 
 DROP TRANSFORM FOR int LANGUAGE SQL;
index c89ec06cb43564e2514ee4d1eee0d9a3627d7267..02070fd8afdb6b819e044758f593a43b6d0e54bc 100644 (file)
@@ -37,8 +37,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
 CREATE USER MAPPING FOR regress_addr_user SERVER "integer";
 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_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_support(internal),
+       FROM SQL WITH FUNCTION prsd_lextype(internal),
        TO SQL WITH FUNCTION int4recv(internal));
 CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
 CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
index fd79465f72724e2a38285cc5b23c44bcb961c7af..f8ee130bfcb2ab3e756f93c739d23f2f887619c4 100644 (file)
@@ -40,8 +40,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
 CREATE USER MAPPING FOR regress_addr_user SERVER "integer";
 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
 ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_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_support(internal),
+       FROM SQL WITH FUNCTION prsd_lextype(internal),
        TO SQL WITH FUNCTION int4recv(internal));
 CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
 CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);