034_tmp.pl
application/octet-stream
Filename: 034_tmp.pl
Type: application/octet-stream
Part: 0
use strict;
use warnings;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;
# Initialize publisher node
my $node_publisher = PostgreSQL::Test::Cluster->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = PostgreSQL::Test::Cluster->new('subscriber');
$node_subscriber->init;
$node_subscriber->start;
my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
my $tbl_count = 1000;
for(my $count = 1; $count <= $tbl_count; $count++) {
$node_publisher->safe_psql('postgres', "CREATE TABLE t_$count(c1 int);");
$node_subscriber->safe_psql('postgres', "CREATE TABLE t_$count(c1 int);");
$node_publisher->safe_psql('postgres', "INSERT INTO t_$count VALUES(1);");
$node_publisher->safe_psql('postgres', "INSERT INTO t_$count VALUES(2);");
}
$node_publisher->safe_psql('postgres', "CREATE PUBLICATION pub1 FOR ALL TABLES;");
$node_subscriber->safe_psql('postgres', "CREATE SUBSCRIPTION sub CONNECTION '$publisher_connstr' PUBLICATION pub1;");
$node_subscriber->wait_for_subscription_sync($node_publisher, 'sub');
my $result =
$node_subscriber->safe_psql('postgres', "SELECT count(*) FROM t_1");
is($result, qq(2), 'check replicated changes with REPLICA IDENTITY NOTHING');
$node_subscriber->stop('fast');
$node_publisher->stop('fast');
done_testing();