Commit 57ca1d4f authored by Andres Freund's avatar Andres Freund

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.
parent ddc2504d
...@@ -89,7 +89,7 @@ SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}'); ...@@ -89,7 +89,7 @@ SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
(1 row) (1 row)
CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$ CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$
SELECT $$dbname='$$||current_database()||$$'$$; SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port');
$f$; $f$;
-- regular old dblink -- regular old dblink
SELECT * SELECT *
...@@ -816,7 +816,9 @@ CREATE ROLE dblink_regression_test; ...@@ -816,7 +816,9 @@ CREATE ROLE dblink_regression_test;
DO $d$ DO $d$
BEGIN BEGIN
EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
OPTIONS (dbname '$$||current_database()||$$')$$; OPTIONS (dbname '$$||current_database()||$$',
port '$$||current_setting('port')||$$'
)$$;
END; END;
$d$; $d$;
CREATE USER MAPPING FOR public SERVER fdtest CREATE USER MAPPING FOR public SERVER fdtest
......
...@@ -56,7 +56,7 @@ SELECT dblink_build_sql_update('"MySchema"."Foo"','1 2',2,'{"0", "a"}','{"99", " ...@@ -56,7 +56,7 @@ SELECT dblink_build_sql_update('"MySchema"."Foo"','1 2',2,'{"0", "a"}','{"99", "
SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}'); SELECT dblink_build_sql_delete('"MySchema"."Foo"','1 2',2,'{"0", "a"}');
CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$ CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS $f$
SELECT $$dbname='$$||current_database()||$$'$$; SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port');
$f$; $f$;
-- regular old dblink -- regular old dblink
...@@ -395,7 +395,9 @@ CREATE ROLE dblink_regression_test; ...@@ -395,7 +395,9 @@ CREATE ROLE dblink_regression_test;
DO $d$ DO $d$
BEGIN BEGIN
EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
OPTIONS (dbname '$$||current_database()||$$')$$; OPTIONS (dbname '$$||current_database()||$$',
port '$$||current_setting('port')||$$'
)$$;
END; END;
$d$; $d$;
......
...@@ -6,7 +6,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw; ...@@ -6,7 +6,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
DO $d$ DO $d$
BEGIN BEGIN
EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (dbname '$$||current_database()||$$');$$; OPTIONS (dbname '$$||current_database()||$$',
port '$$||current_setting('port')||$$'
)$$;
END; END;
$d$; $d$;
CREATE USER MAPPING FOR public SERVER testserver1 CREATE USER MAPPING FOR public SERVER testserver1
......
...@@ -8,7 +8,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw; ...@@ -8,7 +8,9 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
DO $d$ DO $d$
BEGIN BEGIN
EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (dbname '$$||current_database()||$$');$$; OPTIONS (dbname '$$||current_database()||$$',
port '$$||current_setting('port')||$$'
)$$;
END; END;
$d$; $d$;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment