Hi, On Fri, Mar 24, 2017 at 12:32:28AM +0100, Petr Jelinek wrote: > Yes, I also forgot to check if the table actually exists on subscriber > when fetching them in CREATE SUBSCRIPTION (we have check during > replication but not there). > > Attached patches should fix both issues.
I no longer get a segfault, thanks. However, replication also seems to not work, I'm using the following script right now: --8<-- #!/bin/sh set -x #rm -rf data_* pg*.log initdb --pgdata=data_pg1 1> /dev/null 2>&1 sed -i -e 's/^#wal_level.=.replica/wal_level = logical/' data_pg1/postgresql.conf pg_ctl --pgdata=data_pg1 -l pg1.log start 1> /dev/null psql -c "CREATE TABLE t1(id int);" pg_basebackup --pgdata=data_pg2 sed -i -e 's/^#port.=.5432/port = 5433/' data_pg2/postgresql.conf psql -c "INSERT INTO t1 VALUES(1);" pg_ctl --pgdata=data_pg2 -l pg2.log start 1> /dev/null psql -c "CREATE PUBLICATION pub1;" psql --port=5433 -c "CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=postgres' PUBLICATION pub1 WITH (COPY DATA);" sleep 6 psql -c 'SELECT application_name, state FROM pg_stat_replication;' psql --port=5433 -c "SELECT COUNT(*) FROM t1;" --8<-- (I had to add the sleep 6 - 5 wasn't always enough - in order to get the subcription from 'catchup' to 'streaming' which was a bit surprising to me) This is the output: --8<-- + initdb --pgdata=data_pg1 + sed -i -e s/^#wal_level.=.replica/wal_level = logical/ data_pg1/postgresql.conf + pg_ctl --pgdata=data_pg1 -l pg1.log start + psql -c CREATE TABLE t1(id int); CREATE TABLE + pg_basebackup --pgdata=data_pg2 + sed -i -e s/^#port.=.5432/port = 5433/ data_pg2/postgresql.conf + psql -c INSERT INTO t1 VALUES(1); INSERT 0 1 + pg_ctl --pgdata=data_pg2 -l pg2.log start + psql -c CREATE PUBLICATION pub1; CREATE PUBLICATION + psql --port=5433 -c CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=postgres' PUBLICATION pub1 WITH (COPY DATA); NOTICE: created replication slot "sub1" on publisher NOTICE: synchronized table states CREATE SUBSCRIPTION + sleep 6 + psql -c SELECT application_name, state FROM pg_stat_replication; application_name | state ------------------+----------- sub1 | streaming (1 row) + psql --port=5433 -c SELECT COUNT(*) FROM t1; count ------- 0 (1 row) --8<-- I would have assumed the inserted value to be visible on the standby. If I insert further values, don't show up, either. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.ba...@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers