Skip to content

Commit 57ca1d4

Browse files
committed
Specify the port in dblink and postgres_fdw tests.
That allows to run those tests against a postmaster listening on a nonstandard port without requiring to export PGPORT in postmaster's environment. This still doesn't support connecting to a nondefault host without configuring it in postmaster's environment. That's harder and less frequently used though. So this is a useful step.
1 parent ddc2504 commit 57ca1d4

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

contrib/dblink/expected/dblink.out

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
8989
(1 row)
9090

9191
CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$
92-
SELECT $$dbname='$$||current_database()||$$'$$;
92+
SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port');
9393
$f$;
9494
-- regular old dblink
9595
SELECT *
@@ -816,7 +816,9 @@ CREATE ROLE dblink_regression_test;
816816
DO $d$
817817
BEGIN
818818
EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
819-
OPTIONS (dbname '$$||current_database()||$$')$$;
819+
OPTIONS (dbname '$$||current_database()||$$',
820+
port '$$||current_setting('port')||$$'
821+
)$$;
820822
END;
821823
$d$;
822824
CREATE USER MAPPING FOR public SERVER fdtest

contrib/dblink/sql/dblink.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ SELECT dblink_build_sql_update('"MySchema"."Foo"','1 2',2,'{"0", "a"}','{"99", "
5656
SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
5757

5858
CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$
59-
SELECT $$dbname='$$||current_database()||$$'$$;
59+
SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port');
6060
$f$;
6161

6262
-- regular old dblink
@@ -395,7 +395,9 @@ CREATE ROLE dblink_regression_test;
395395
DO $d$
396396
BEGIN
397397
EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
398-
OPTIONS (dbname '$$||current_database()||$$')$$;
398+
OPTIONS (dbname '$$||current_database()||$$',
399+
port '$$||current_setting('port')||$$'
400+
)$$;
399401
END;
400402
$d$;
401403

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
66
DO $d$
77
BEGIN
88
EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
9-
OPTIONS (dbname '$$||current_database()||$$');$$;
9+
OPTIONS (dbname '$$||current_database()||$$',
10+
port '$$||current_setting('port')||$$'
11+
)$$;
1012
END;
1113
$d$;
1214
CREATE USER MAPPING FOR public SERVER testserver1

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
88
DO $d$
99
BEGIN
1010
EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
11-
OPTIONS (dbname '$$||current_database()||$$');$$;
11+
OPTIONS (dbname '$$||current_database()||$$',
12+
port '$$||current_setting('port')||$$'
13+
)$$;
1214
END;
1315
$d$;
1416

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