summaryrefslogtreecommitdiff
path: root/contrib/test_decoding/sql/ddl.sql
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-06-27 18:49:00 +0200
committerAndres Freund <andres@anarazel.de>2015-06-27 19:00:45 +0200
commitd47a1136e441cebe7ae7fe72d70eb8ce278d5cd6 (patch)
tree6f314fe0989a0de9f1445113dea5b3b13e34de6e /contrib/test_decoding/sql/ddl.sql
parent604e99396de02f6f23950ee373c13335d2ccdf05 (diff)
Fix test_decoding's handling of nonexistant columns in old tuple versions.
test_decoding used fastgetattr() to extract column values. That's wrong when decoding updates and deletes if a table's replica identity is set to FULL and new columns have been added since the old version of the tuple was created. Due to the lack of a crosscheck with the datum's natts values an invalid value will be output, leading to errors or worse. Bug: #13470 Reported-By: Krzysztof Kotlarski Discussion: 20150626100333.3874.90852@wrigleys.postgresql.org Backpatch to 9.4, where the feature, including the bug, was added.
Diffstat (limited to 'contrib/test_decoding/sql/ddl.sql')
-rw-r--r--contrib/test_decoding/sql/ddl.sql4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/test_decoding/sql/ddl.sql b/contrib/test_decoding/sql/ddl.sql
index 9c0502f1558..e311c5966e0 100644
--- a/contrib/test_decoding/sql/ddl.sql
+++ b/contrib/test_decoding/sql/ddl.sql
@@ -277,6 +277,10 @@ ALTER TABLE table_without_key REPLICA IDENTITY FULL;
UPDATE table_without_key SET data = 3 WHERE data = 2;
UPDATE table_without_key SET id = -id;
UPDATE table_without_key SET id = -id;
+-- ensure that FULL correctly deals with new columns
+ALTER TABLE table_without_key ADD COLUMN new_column text;
+UPDATE table_without_key SET id = -id;
+UPDATE table_without_key SET id = -id, new_column = 'someval';
DELETE FROM table_without_key WHERE data = 3;
CREATE TABLE table_with_pkey(id serial primary key, data int);