diff --git a/contrib/test_decoding/expected/generated_columns.out b/contrib/test_decoding/expected/generated_columns.out index 48f900f..9b03f6d 100644 --- a/contrib/test_decoding/expected/generated_columns.out +++ b/contrib/test_decoding/expected/generated_columns.out @@ -1,13 +1,14 @@ --- test decoding of generated columns +-- Test decoding of generated columns. SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding'); ?column? ---------- init (1 row) --- column b' is a generated column +-- Column b' is a generated column. CREATE TABLE gencoltable (a int, b int GENERATED ALWAYS AS (a * 2) STORED); --- By default, 'include-generated-columns' is enabled, so the values for the generated column 'b' will be replicated even if it is not explicitly specified. +-- For 'test_decoding' the parameter 'include-generated-columns' is enabled by default, +-- so the values for the generated column 'b' will be replicated even if it is not explicitly specified. INSERT INTO gencoltable (a) VALUES (1); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); data @@ -17,7 +18,7 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc COMMIT (3 rows) --- when 'include-generated-columns' is enabled, the values of the generated column 'b' will be replicated. +-- When 'include-generated-columns' is enabled, the values of the generated column 'b' will be replicated. INSERT INTO gencoltable (a) VALUES (2); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '1'); data @@ -27,7 +28,7 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc COMMIT (3 rows) --- when 'include-generated-columns' is disabled, the values of the generated column 'b' will not be replicated. +-- When 'include-generated-columns' is disabled, the values of the generated column 'b' will not be replicated. INSERT INTO gencoltable (a) VALUES (3); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '0'); data @@ -37,7 +38,7 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc COMMIT (3 rows) --- with REPLICA IDENTITY = FULL, to show old-key data includes generated columns data for updates. +-- When REPLICA IDENTITY = FULL, show old-key data includes generated columns data for updates. ALTER TABLE gencoltable REPLICA IDENTITY FULL; UPDATE gencoltable SET a = 10; SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '1'); diff --git a/contrib/test_decoding/sql/generated_columns.sql b/contrib/test_decoding/sql/generated_columns.sql index fb156c2..7b455a1 100644 --- a/contrib/test_decoding/sql/generated_columns.sql +++ b/contrib/test_decoding/sql/generated_columns.sql @@ -1,23 +1,24 @@ --- test decoding of generated columns +-- Test decoding of generated columns. SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding'); --- column b' is a generated column +-- Column b' is a generated column. CREATE TABLE gencoltable (a int, b int GENERATED ALWAYS AS (a * 2) STORED); --- By default, 'include-generated-columns' is enabled, so the values for the generated column 'b' will be replicated even if it is not explicitly specified. +-- For 'test_decoding' the parameter 'include-generated-columns' is enabled by default, +-- so the values for the generated column 'b' will be replicated even if it is not explicitly specified. INSERT INTO gencoltable (a) VALUES (1); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); --- when 'include-generated-columns' is enabled, the values of the generated column 'b' will be replicated. +-- When 'include-generated-columns' is enabled, the values of the generated column 'b' will be replicated. INSERT INTO gencoltable (a) VALUES (2); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '1'); --- when 'include-generated-columns' is disabled, the values of the generated column 'b' will not be replicated. +-- When 'include-generated-columns' is disabled, the values of the generated column 'b' will not be replicated. INSERT INTO gencoltable (a) VALUES (3); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '0'); --- with REPLICA IDENTITY = FULL, to show old-key data includes generated columns data for updates. +-- When REPLICA IDENTITY = FULL, show old-key data includes generated columns data for updates. ALTER TABLE gencoltable REPLICA IDENTITY FULL; UPDATE gencoltable SET a = 10; SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'include-generated-columns', '1');