mirror of
https://github.com/postgres/postgres.git
synced 2026-06-10 09:10:33 -04:00
Clean up postgres_fdw/t/010_subscription.pl.
The test was based on test/subscription/002_rep_changes.pl, but had some leftover copy+paste problems that were useless and/or distracting. Discussion: https://postgr.es/m/CAA4eK1+=V_UFNHwcoMFqzy0F4AtS9_GyXhQDUzizgieQPWr=0A@mail.gmail.com Reported-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
This commit is contained in:
parent
7a2ab122a1
commit
f4af7849b3
1 changed files with 4 additions and 11 deletions
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
# Copyright (c) 2021-2026, PostgreSQL Global Development Group
|
||||
|
||||
# Basic logical replication test
|
||||
# Test postgres_fdw foreign server for use with a subscription.
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
|
@ -22,11 +23,6 @@ $node_subscriber->start;
|
|||
$node_publisher->safe_psql('postgres',
|
||||
"CREATE TABLE tab_ins AS SELECT a, a + 1 as b FROM generate_series(1,1002) AS a");
|
||||
|
||||
# Replicate the changes without columns
|
||||
$node_publisher->safe_psql('postgres', "CREATE TABLE tab_no_col()");
|
||||
$node_publisher->safe_psql('postgres',
|
||||
"INSERT INTO tab_no_col default VALUES");
|
||||
|
||||
# Setup structure on subscriber
|
||||
$node_subscriber->safe_psql('postgres', "CREATE EXTENSION postgres_fdw");
|
||||
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_ins (a int, b int)");
|
||||
|
|
@ -45,9 +41,6 @@ $node_subscriber->safe_psql('postgres',
|
|||
"CREATE USER MAPPING FOR PUBLIC SERVER tap_server"
|
||||
);
|
||||
|
||||
$node_subscriber->safe_psql('postgres',
|
||||
"CREATE FOREIGN TABLE f_tab_ins (a int, b int) SERVER tap_server OPTIONS(table_name 'tab_ins')"
|
||||
);
|
||||
$node_subscriber->safe_psql('postgres',
|
||||
"CREATE SUBSCRIPTION tap_sub SERVER tap_server PUBLICATION tap_pub WITH (password_required=false)"
|
||||
);
|
||||
|
|
@ -56,7 +49,7 @@ $node_subscriber->safe_psql('postgres',
|
|||
$node_subscriber->wait_for_subscription_sync($node_publisher, 'tap_sub');
|
||||
|
||||
my $result =
|
||||
$node_subscriber->safe_psql('postgres', "SELECT count(*) FROM (SELECT f.b = l.b as match FROM tab_ins l, f_tab_ins f WHERE l.a = f.a) WHERE match");
|
||||
$node_subscriber->safe_psql('postgres', "SELECT count(*) FROM tab_ins");
|
||||
is($result, qq(1002), 'check that initial data was copied to subscriber');
|
||||
|
||||
$node_publisher->safe_psql('postgres',
|
||||
|
|
@ -65,7 +58,7 @@ $node_publisher->safe_psql('postgres',
|
|||
$node_publisher->wait_for_catchup('tap_sub');
|
||||
|
||||
$result =
|
||||
$node_subscriber->safe_psql('postgres', "SELECT count(*) FROM (SELECT f.b = l.b as match FROM tab_ins l, f_tab_ins f WHERE l.a = f.a) WHERE match");
|
||||
$node_subscriber->safe_psql('postgres', "SELECT count(*) FROM tab_ins");
|
||||
is($result, qq(1050), 'check that inserted data was copied to subscriber');
|
||||
|
||||
done_testing();
|
||||
|
|
|
|||
Loading…
Reference in a new issue