|
3 | 3 | use warnings;
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 1; |
| 6 | +use Test::More tests => 3; |
7 | 7 |
|
8 | 8 | sub wait_for_caught_up
|
9 | 9 | {
|
@@ -72,3 +72,38 @@ sub wait_for_caught_up
|
72 | 72 | wait_for_caught_up($node_publisher, 'sub1');
|
73 | 73 |
|
74 | 74 | pass('index predicates do not cause crash');
|
| 75 | + |
| 76 | +$node_publisher->stop('fast'); |
| 77 | +$node_subscriber->stop('fast'); |
| 78 | + |
| 79 | + |
| 80 | +# Handling of temporary and unlogged tables with FOR ALL TABLES publications |
| 81 | + |
| 82 | +# If a FOR ALL TABLES publication exists, temporary and unlogged |
| 83 | +# tables are ignored for publishing changes. The bug was that we |
| 84 | +# would still check in that case that such a table has a replica |
| 85 | +# identity set before accepting updates. If it did not it would cause |
| 86 | +# an error when an update was attempted. |
| 87 | + |
| 88 | +$node_publisher = get_new_node('publisher2'); |
| 89 | +$node_publisher->init(allows_streaming => 'logical'); |
| 90 | +$node_publisher->start; |
| 91 | + |
| 92 | +$node_publisher->safe_psql('postgres', |
| 93 | + "CREATE PUBLICATION pub FOR ALL TABLES"); |
| 94 | + |
| 95 | +is( $node_publisher->psql( |
| 96 | + 'postgres', |
| 97 | + "CREATE TEMPORARY TABLE tt1 AS SELECT 1 AS a; UPDATE tt1 SET a = 2;"), |
| 98 | + 0, |
| 99 | + 'update to temporary table without replica identity with FOR ALL TABLES publication' |
| 100 | +); |
| 101 | + |
| 102 | +is( $node_publisher->psql( |
| 103 | + 'postgres', |
| 104 | + "CREATE UNLOGGED TABLE tu1 AS SELECT 1 AS a; UPDATE tu1 SET a = 2;"), |
| 105 | + 0, |
| 106 | + 'update to unlogged table without replica identity with FOR ALL TABLES publication' |
| 107 | +); |
| 108 | + |
| 109 | +$node_publisher->stop('fast'); |
0 commit comments