Skip to content

Commit 783cbb6

Browse files
committed
postgres_fdw: Fix tests with ANALYZE and remote sampling
The tests fixed in this commit were changing the sampling setting of a foreign server, but then were analyzing a local table instead of a foreign table, meaning that the test was not running for its original purpose. This commit changes the ANALYZE commands to analyze the foreign table, and changes the foreign table definition to point to a valid remote table. Attempting to analyze the foreign table "analyze_ftable" would have failed before this commit, because "analyze_rtable1" is not defined on the remote side. Issue introduced by 8ad51b5. Author: Corey Huinker <corey.huinker@gmail.com> Discussion: https://postgr.es/m/CADkLM=cpUiJ3QF7aUthTvaVMmgQcm7QqZBRMDLhBRTR+gJX-Og@mail.gmail.com Backpatch-through: 16
1 parent 5f19d13 commit 783cbb6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12649,23 +12649,23 @@ ALTER SERVER loopback2 OPTIONS (DROP parallel_abort);
1264912649
-- ===================================================================
1265012650
CREATE TABLE analyze_table (id int, a text, b bigint);
1265112651
CREATE FOREIGN TABLE analyze_ftable (id int, a text, b bigint)
12652-
SERVER loopback OPTIONS (table_name 'analyze_rtable1');
12652+
SERVER loopback OPTIONS (table_name 'analyze_table');
1265312653
INSERT INTO analyze_table (SELECT x FROM generate_series(1,1000) x);
1265412654
ANALYZE analyze_table;
1265512655
SET default_statistics_target = 10;
1265612656
ANALYZE analyze_table;
1265712657
ALTER SERVER loopback OPTIONS (analyze_sampling 'invalid');
1265812658
ERROR: invalid value for string option "analyze_sampling": invalid
1265912659
ALTER SERVER loopback OPTIONS (analyze_sampling 'auto');
12660-
ANALYZE analyze_table;
12660+
ANALYZE analyze_ftable;
1266112661
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'system');
12662-
ANALYZE analyze_table;
12662+
ANALYZE analyze_ftable;
1266312663
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'bernoulli');
12664-
ANALYZE analyze_table;
12664+
ANALYZE analyze_ftable;
1266512665
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'random');
12666-
ANALYZE analyze_table;
12666+
ANALYZE analyze_ftable;
1266712667
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'off');
12668-
ANALYZE analyze_table;
12668+
ANALYZE analyze_ftable;
1266912669
-- cleanup
1267012670
DROP FOREIGN TABLE analyze_ftable;
1267112671
DROP TABLE analyze_table;

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4365,7 +4365,7 @@ ALTER SERVER loopback2 OPTIONS (DROP parallel_abort);
43654365
CREATE TABLE analyze_table (id int, a text, b bigint);
43664366

43674367
CREATE FOREIGN TABLE analyze_ftable (id int, a text, b bigint)
4368-
SERVER loopback OPTIONS (table_name 'analyze_rtable1');
4368+
SERVER loopback OPTIONS (table_name 'analyze_table');
43694369

43704370
INSERT INTO analyze_table (SELECT x FROM generate_series(1,1000) x);
43714371
ANALYZE analyze_table;
@@ -4376,19 +4376,19 @@ ANALYZE analyze_table;
43764376
ALTER SERVER loopback OPTIONS (analyze_sampling 'invalid');
43774377

43784378
ALTER SERVER loopback OPTIONS (analyze_sampling 'auto');
4379-
ANALYZE analyze_table;
4379+
ANALYZE analyze_ftable;
43804380

43814381
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'system');
4382-
ANALYZE analyze_table;
4382+
ANALYZE analyze_ftable;
43834383

43844384
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'bernoulli');
4385-
ANALYZE analyze_table;
4385+
ANALYZE analyze_ftable;
43864386

43874387
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'random');
4388-
ANALYZE analyze_table;
4388+
ANALYZE analyze_ftable;
43894389

43904390
ALTER SERVER loopback OPTIONS (SET analyze_sampling 'off');
4391-
ANALYZE analyze_table;
4391+
ANALYZE analyze_ftable;
43924392

43934393
-- cleanup
43944394
DROP FOREIGN TABLE analyze_ftable;

0 commit comments

Comments
 (0)