In the OP_Column opcode, when extracting a field that is past the end of

a short record (because the row was originally inserted prior to ALTER TABLE
ADD COLUMN) then make sure the output register is fully NULL and does not
contain leftover flags (such as MEM_Ephem) from its previous use.
Fix for ticket [43107840f1c02].

FossilOrigin-Name: 24780f8ddc1683fc62180e6961dc6bfe1168f4df
This commit is contained in:
drh
2014-10-29 00:58:38 +00:00
parent aa55563d7e
commit 22e8d833f0
4 changed files with 24 additions and 10 deletions
+14
View File
@@ -604,5 +604,19 @@ do_test update-14.4 {
} ;# ifcapable {trigger}
# Ticket [https://www.sqlite.org/src/tktview/43107840f1c02] on 2014-10-29
# An assertion fault on UPDATE
#
do_execsql_test update-15.1 {
CREATE TABLE t15(a INTEGER PRIMARY KEY, b);
INSERT INTO t15(a,b) VALUES(10,'abc'),(20,'def'),(30,'ghi');
ALTER TABLE t15 ADD COLUMN c;
CREATE INDEX t15c ON t15(c);
INSERT INTO t15(a,b)
VALUES(5,'zyx'),(15,'wvu'),(25,'tsr'),(35,'qpo');
UPDATE t15 SET c=printf("y%d",a) WHERE c IS NULL;
SELECT a,b,c,'|' FROM t15 ORDER BY a;
} {5 zyx y5 | 10 abc y10 | 15 wvu y15 | 20 def y20 | 25 tsr y25 | 30 ghi y30 | 35 qpo y35 |}
finish_test