|
1184 | 1184 | is( $result, qq(t
|
1185 | 1185 | t), 'check the number of columns in the old tuple');
|
1186 | 1186 |
|
| 1187 | +# TEST: Generated and dropped columns are not considered for the column list. |
| 1188 | +# So, the publication having a column list except for those columns and a |
| 1189 | +# publication without any column (aka all columns as part of the columns |
| 1190 | +# list) are considered to have the same column list. |
| 1191 | +$node_publisher->safe_psql( |
| 1192 | + 'postgres', qq( |
| 1193 | + CREATE TABLE test_mix_4 (a int PRIMARY KEY, b int, c int, d int GENERATED ALWAYS AS (a + 1) STORED); |
| 1194 | + ALTER TABLE test_mix_4 DROP COLUMN c; |
| 1195 | +
|
| 1196 | + CREATE PUBLICATION pub_mix_7 FOR TABLE test_mix_4 (a, b); |
| 1197 | + CREATE PUBLICATION pub_mix_8 FOR TABLE test_mix_4; |
| 1198 | +
|
| 1199 | + -- initial data |
| 1200 | + INSERT INTO test_mix_4 VALUES (1, 2); |
| 1201 | +)); |
| 1202 | + |
| 1203 | +$node_subscriber->safe_psql( |
| 1204 | + 'postgres', qq( |
| 1205 | + DROP SUBSCRIPTION sub1; |
| 1206 | + CREATE TABLE test_mix_4 (a int PRIMARY KEY, b int, c int, d int); |
| 1207 | +)); |
| 1208 | + |
| 1209 | +$node_subscriber->safe_psql( |
| 1210 | + 'postgres', qq( |
| 1211 | + CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr' PUBLICATION pub_mix_7, pub_mix_8; |
| 1212 | +)); |
| 1213 | + |
| 1214 | +$node_subscriber->wait_for_subscription_sync; |
| 1215 | + |
| 1216 | +is( $node_subscriber->safe_psql( |
| 1217 | + 'postgres', "SELECT * FROM test_mix_4 ORDER BY a"), |
| 1218 | + qq(1|2||), |
| 1219 | + 'initial synchronization with multiple publications with the same column list' |
| 1220 | +); |
| 1221 | + |
| 1222 | +$node_publisher->safe_psql( |
| 1223 | + 'postgres', qq( |
| 1224 | + INSERT INTO test_mix_4 VALUES (3, 4); |
| 1225 | +)); |
| 1226 | + |
| 1227 | +$node_publisher->wait_for_catchup('sub1'); |
| 1228 | + |
| 1229 | +is( $node_subscriber->safe_psql( |
| 1230 | + 'postgres', "SELECT * FROM test_mix_4 ORDER BY a"), |
| 1231 | + qq(1|2|| |
| 1232 | +3|4||), |
| 1233 | + 'replication with multiple publications with the same column list'); |
1187 | 1234 |
|
1188 | 1235 | # TEST: With a table included in multiple publications with different column
|
1189 | 1236 | # lists, we should catch the error when creating the subscription.
|
|
0 commit comments