PS_NITPICKS_20240627_GENCOLS_V110001.txt
text/plain
Filename: PS_NITPICKS_20240627_GENCOLS_V110001.txt
Type: text/plain
Part: 0
diff --git a/contrib/test_decoding/expected/binary.out b/contrib/test_decoding/expected/binary.out
index c30abc7..b3a3509 100644
--- a/contrib/test_decoding/expected/binary.out
+++ b/contrib/test_decoding/expected/binary.out
@@ -1,7 +1,11 @@
-- predictability
SET synchronous_commit = on;
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
-ERROR: replication slot "regression_slot" already exists
+ ?column?
+----------
+ init
+(1 row)
+
-- succeeds, textual plugin, textual consumer
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1');
data
diff --git a/contrib/test_decoding/expected/decoding_into_rel.out b/contrib/test_decoding/expected/decoding_into_rel.out
index f763e05..8fd3390 100644
--- a/contrib/test_decoding/expected/decoding_into_rel.out
+++ b/contrib/test_decoding/expected/decoding_into_rel.out
@@ -103,3 +103,9 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc
COMMIT
(14 rows)
+SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
+ ?column?
+----------
+ stop
+(1 row)
+
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 0f62013..91a292b 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -514,9 +514,10 @@ CREATE TABLE people (
</listitem>
<listitem>
<para>
- 'include_generated_columns' option controls whether generated columns
- should be included in the string representation of tuples during
- logical decoding in PostgreSQL. The default is <literal>true</literal>.
+ Generated columns may be skipped during logical replication according to the
+ <command>CREATE SUBSCRIPTION</command> option
+ <link linkend="sql-createsubscription-params-with-include-generated-columns">
+ <literal>include_generated_columns</literal></link>,
</para>
</listitem>
</itemizedlist>
diff --git a/src/test/subscription/t/011_generated.pl b/src/test/subscription/t/011_generated.pl
index bc6033a..25edc6f 100644
--- a/src/test/subscription/t/011_generated.pl
+++ b/src/test/subscription/t/011_generated.pl
@@ -31,13 +31,11 @@ $node_subscriber->safe_psql('postgres',
# publisher-side tab2 has generated col 'b' but subscriber-side tab2 has NON-generated col 'b'.
$node_publisher->safe_psql('postgres',
"CREATE TABLE tab2 (a int, b int GENERATED ALWAYS AS (a * 2) STORED)");
-
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab2 (a int, b int)");
-# publisher-side tab3 has generated col 'b' but subscriber-side tab2 has DIFFERENT COMPUTATION generated col 'b'.
+# publisher-side tab3 has generated col 'b' but subscriber-side tab3 has DIFFERENT COMPUTATION generated col 'b'.
$node_publisher->safe_psql('postgres',
"CREATE TABLE tab3 (a int, b int GENERATED ALWAYS AS (a + 10) STORED)");
-
$node_subscriber->safe_psql('postgres',
"CREATE TABLE tab3 (a int, b int GENERATED ALWAYS AS (a + 20) STORED)");
@@ -60,11 +58,9 @@ $node_publisher->safe_psql('postgres',
$node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr' PUBLICATION pub1"
);
-
$node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub2 CONNECTION '$publisher_connstr' PUBLICATION pub2 WITH (include_generated_columns = true, copy_data = false)"
);
-
$node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub3 CONNECTION '$publisher_connstr' PUBLICATION pub3 WITH (include_generated_columns = true, copy_data = false)"
);
@@ -98,11 +94,12 @@ is( $result, qq(1|22|
4|88|
6|132|), 'generated columns replicated');
+#
+# TEST tab2: the publisher-side col 'b' is generated, and the subscriber-side
+# col 'b' is not generated, so confirm that col 'b' IS replicated.
+#
$node_publisher->safe_psql('postgres', "INSERT INTO tab2 VALUES (4), (5)");
-
$node_publisher->wait_for_catchup('sub2');
-
-# the column was NOT replicated (the result value of 'b' is the subscriber-side computed value)
$result =
$node_subscriber->safe_psql('postgres', "SELECT a, b FROM tab2 ORDER BY a");
is( $result, qq(4|8
@@ -110,10 +107,14 @@ is( $result, qq(4|8
'confirm generated columns ARE replicated when the subscriber-side column is not generated'
);
+#
+# TEST tab3: the publisher-side col 'b' is generated, and the subscriber-side
+# col 'b' is also generated, so confirmed that col 'b' IS NOT replicated. We
+# can know this because the result value is the subscriber-side computation
+# (which is not the same as the publisher-side computation for col 'b').
+#
$node_publisher->safe_psql('postgres', "INSERT INTO tab3 VALUES (4), (5)");
-
$node_publisher->wait_for_catchup('sub3');
-
$result =
$node_subscriber->safe_psql('postgres', "SELECT a, b FROM tab3 ORDER BY a");
is( $result, qq(4|24
diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl
index 6e73f89..9804158 100644
--- a/src/test/subscription/t/031_column_list.pl
+++ b/src/test/subscription/t/031_column_list.pl
@@ -1204,7 +1204,7 @@ t), 'check the number of columns in the old tuple');
# TEST: Dropped columns are not considered for the column list.
# So, the publication having a column list except for those columns and a
-# publication without any column (aka all columns as part of the columns
+# publication without any column list (aka all columns as part of the columns
# list) are considered to have the same column list.
$node_publisher->safe_psql(
'postgres', qq(