Do not set OP_Column flags on the instructions generated by

sqlite3ExprCodeGetColumn() if the opcode generated is not really an
OP_Column, which might happen if the column is virtual.
Fix for ticket [b439bfcfb7deedc6]

FossilOrigin-Name: 2401e04730a156aa48787b91af4e516406cb7635145e430be62fd16481816237
This commit is contained in:
drh 2019-12-14 17:43:37 +00:00
parent aac30f9b50
commit 99670abb82
4 changed files with 25 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Make\sthe\ssqlite3ExprCodeTarget()\sexpression\scode\sgenerator\sroutine\srobust\nin\sthe\sface\sof\sunknown\sopcodes\s-\sit\ssimply\sgenerates\sa\sNULL\svalue.
D 2019-12-14T15:01:55.918
C Do\snot\sset\sOP_Column\sflags\son\sthe\sinstructions\sgenerated\sby\nsqlite3ExprCodeGetColumn()\sif\sthe\sopcode\sgenerated\sis\snot\sreally\san\nOP_Column,\swhich\smight\shappen\sif\sthe\scolumn\sis\svirtual.\nFix\sfor\sticket\s[b439bfcfb7deedc6]
D 2019-12-14T17:43:37.070
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -479,7 +479,7 @@ F src/date.c e1d8ac7102f3f283e63e13867acb0efa33861cf34f0faf4cdbaf9fa7a1eb7041
F src/dbpage.c 135eb3b5e74f9ef74bde5cec2571192c90c86984fa534c88bf4a055076fa19b7
F src/dbstat.c 6c407e549406c10fde9ac3987f6d734459205239ad370369bc5fcd683084a4fa
F src/delete.c a5c59b9c0251cf7682bc52af0d64f09b1aefc6781a63592c8f1136f7b73c66e4
F src/expr.c 530df5b8b684f94f0217115da30d292964385a83e87945bd9d7d792b08eb7d17
F src/expr.c 7c21a77ca00cc09f500c21cdae7fb3571490c2dec70b392d9e505e81069e45ee
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847
F src/func.c ed33e38cd642058182a31a3f518f2e34f4bbe53aa483335705c153c4d3e50b12
@ -1022,7 +1022,7 @@ F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c
F test/gencol1.test aab394862d6c14a57ff488b0ef3413ed9f3067a56955ede25b5e059188a66a41
F test/gencol1.test 1cd2b6cfd3ba0a9fe12569db5bcd8972cb83f81586121e8d769905f3b3612879
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
F test/having.test e4098a4b8962f9596035c3b87a8928a10648acc509f1bb8d6f96413bbf79a1b3
F test/hexlit.test 4a6a5f46e3c65c4bf1fa06f5dd5a9507a5627751
@ -1852,7 +1852,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 3b873029ef1903f76442445343af3786cd59ee66b0e5e0e6b76a0b6b1b5eb88a
R 85c383a5f778e584f7e14589390faee1
P f8e876c82a246ceed32b166f64e05dfe5ce4ab4c6820be60404109b43d36bb80
R 3e1bcf29405c2bc765bc5cc02f705dba
U drh
Z d36aae0806eadd62df0ee61e4708a6ba
Z d5d947f7a3e61dce535fe821e852738a

View File

@ -1 +1 @@
f8e876c82a246ceed32b166f64e05dfe5ce4ab4c6820be60404109b43d36bb80
2401e04730a156aa48787b91af4e516406cb7635145e430be62fd16481816237

View File

@ -3487,7 +3487,8 @@ int sqlite3ExprCodeGetColumn(
assert( pParse->pVdbe!=0 );
sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pTab, iTable, iColumn, iReg);
if( p5 ){
sqlite3VdbeChangeP5(pParse->pVdbe, p5);
VdbeOp *pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1);
if( pOp->opcode==OP_Column ) pOp->p5 = p5;
}
return iReg;
}

View File

@ -342,7 +342,7 @@ do_execsql_test gencol1-12.10 {
PRAGMA integrity_check;
} {ok}
# 2019-12-09 but report from Yongheng Chen
# 2019-12-09 bug report from Yongheng Chen
# Ensure that the SrcList_item.colUsed field is set correctly when a
# generated column appears in the USING clause of a join.
#
@ -369,5 +369,19 @@ do_execsql_test gencol1-13.22 {
SELECT 456 FROM t1 JOIN t1 USING (x,x);
} {456}
# 2019-12-14 ticket b439bfcfb7deedc6
#
sqlite3 db :memory:
do_execsql_test gencol1-14.10 {
CREATE TABLE t0(c0 AS(1 >= 1), c1 UNIQUE AS(TYPEOF(c0)), c2);
INSERT INTO t0 VALUES(0);
REINDEX;
SELECT * FROM t0;
} {1 integer 0}
do_catchsql_test gencol1-14.10 {
INSERT INTO t0 VALUES(2);
} {1 {UNIQUE constraint failed: t0.c1}}
finish_test