Skip to content

Commit 068503c

Browse files
committed
Solve cross-version-upgrade testing problem induced by 1fb57af.
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.
1 parent 4dbe196 commit 068503c

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,9 +1897,9 @@
18971897
'CREATE TRANSFORM FOR int' => {
18981898
create_order => 34,
18991899
create_sql =>
1900-
'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_support(internal), TO SQL WITH FUNCTION int4recv(internal));',
1900+
'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION prsd_lextype(internal), TO SQL WITH FUNCTION int4recv(internal));',
19011901
regexp =>
1902-
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,
1902+
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,
19031903
like => { %full_runs, section_pre_data => 1, },
19041904
},
19051905

src/test/modules/test_ddl_deparse/expected/create_transform.out

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
-- The function FROM SQL should have internal as single argument as well
66
-- as return type. The function TO SQL should have as single argument
77
-- internal and as return argument the datatype of the transform done.
8-
-- pl/plpgsql does not authorize the use of internal as data type.
8+
-- We choose some random built-in functions that have the right signature.
9+
-- This won't actually be used, because the SQL function language
10+
-- doesn't implement transforms (there would be no point).
911
CREATE TRANSFORM FOR int LANGUAGE SQL (
10-
FROM SQL WITH FUNCTION varchar_support(internal),
12+
FROM SQL WITH FUNCTION prsd_lextype(internal),
1113
TO SQL WITH FUNCTION int4recv(internal));
1214
NOTICE: DDL test: type simple, tag CREATE TRANSFORM
1315
DROP TRANSFORM FOR int LANGUAGE SQL;

src/test/modules/test_ddl_deparse/sql/create_transform.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
-- The function FROM SQL should have internal as single argument as well
77
-- as return type. The function TO SQL should have as single argument
88
-- internal and as return argument the datatype of the transform done.
9-
-- pl/plpgsql does not authorize the use of internal as data type.
9+
-- We choose some random built-in functions that have the right signature.
10+
-- This won't actually be used, because the SQL function language
11+
-- doesn't implement transforms (there would be no point).
1012
CREATE TRANSFORM FOR int LANGUAGE SQL (
11-
FROM SQL WITH FUNCTION varchar_support(internal),
13+
FROM SQL WITH FUNCTION prsd_lextype(internal),
1214
TO SQL WITH FUNCTION int4recv(internal));
1315

1416
DROP TRANSFORM FOR int LANGUAGE SQL;

src/test/regress/expected/object_address.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
3737
CREATE USER MAPPING FOR regress_addr_user SERVER "integer";
3838
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
3939
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_addr_user;
40+
-- this transform would be quite unsafe to leave lying around,
41+
-- except that the SQL language pays no attention to transforms:
4042
CREATE TRANSFORM FOR int LANGUAGE SQL (
41-
FROM SQL WITH FUNCTION varchar_support(internal),
43+
FROM SQL WITH FUNCTION prsd_lextype(internal),
4244
TO SQL WITH FUNCTION int4recv(internal));
4345
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
4446
CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);

src/test/regress/sql/object_address.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
4040
CREATE USER MAPPING FOR regress_addr_user SERVER "integer";
4141
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
4242
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_addr_user;
43+
-- this transform would be quite unsafe to leave lying around,
44+
-- except that the SQL language pays no attention to transforms:
4345
CREATE TRANSFORM FOR int LANGUAGE SQL (
44-
FROM SQL WITH FUNCTION varchar_support(internal),
46+
FROM SQL WITH FUNCTION prsd_lextype(internal),
4547
TO SQL WITH FUNCTION int4recv(internal));
4648
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
4749
CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy