|
3 | 3 | use warnings;
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 8; |
| 6 | +use Test::More tests => 9; |
7 | 7 |
|
8 | 8 | # Bug #15114
|
9 | 9 |
|
|
228 | 228 | $node_publisher->stop('fast');
|
229 | 229 | $node_subscriber->stop('fast');
|
230 | 230 |
|
231 |
| -# The bug was that when the REPLICA IDENTITY FULL is used with dropped columns, |
232 |
| -# we fail to apply updates and deletes |
| 231 | +# The bug was that when the REPLICA IDENTITY FULL is used with dropped or |
| 232 | +# generated columns, we fail to apply updates and deletes |
233 | 233 | my $node_publisher_d_cols = get_new_node('node_publisher_d_cols');
|
234 | 234 | $node_publisher_d_cols->init(allows_streaming => 'logical');
|
235 | 235 | $node_publisher_d_cols->start;
|
|
242 | 242 | 'postgres', qq(
|
243 | 243 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
244 | 244 | ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
|
245 |
| - CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols; |
| 245 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
| 246 | + ALTER TABLE generated_cols REPLICA IDENTITY FULL; |
| 247 | + CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols; |
246 | 248 | -- some initial data
|
247 | 249 | INSERT INTO dropped_cols VALUES (1, 1, 1);
|
| 250 | + INSERT INTO generated_cols (a, c) VALUES (1, 1); |
248 | 251 | ));
|
249 | 252 |
|
250 | 253 | $node_subscriber_d_cols->safe_psql(
|
251 | 254 | 'postgres', qq(
|
252 | 255 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
| 256 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
253 | 257 | ));
|
254 | 258 |
|
255 | 259 | my $publisher_connstr_d_cols =
|
|
271 | 275 | $node_publisher_d_cols->safe_psql(
|
272 | 276 | 'postgres', qq(
|
273 | 277 | UPDATE dropped_cols SET a = 100;
|
| 278 | + UPDATE generated_cols SET a = 100; |
274 | 279 | ));
|
275 | 280 | $node_publisher_d_cols->wait_for_catchup('sub_dropped_cols');
|
276 | 281 |
|
|
279 | 284 | qq(1),
|
280 | 285 | 'replication with RI FULL and dropped columns');
|
281 | 286 |
|
| 287 | +is( $node_subscriber_d_cols->safe_psql( |
| 288 | + 'postgres', "SELECT count(*) FROM generated_cols WHERE a = 100"), |
| 289 | + qq(1), |
| 290 | + 'replication with RI FULL and generated columns'); |
| 291 | + |
282 | 292 | $node_publisher_d_cols->stop('fast');
|
283 | 293 | $node_subscriber_d_cols->stop('fast');
|
0 commit comments