Minor adjustments for clarity and test coverage.

FossilOrigin-Name: 30065716878d4058e75eb510b0b27b68e5193d04625eb173210de8061f20f499
This commit is contained in:
drh 2019-10-23 15:47:33 +00:00
parent ab0992f022
commit 6ab61d7052
7 changed files with 48 additions and 28 deletions

View File

@ -1,5 +1,5 @@
C Fix\sincorrect\sarguments\sto\stestcase()\smacros.
D 2019-10-23T03:53:10.742
C Minor\sadjustments\sfor\sclarity\sand\stest\scoverage.
D 2019-10-23T15:47:33.769
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -469,7 +469,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c a8a9c2ce62bdf54c8cf9795143d7cb10b7473a1230a0572f702d061ffcceefe5
F src/btree.h f27a33c49280209a93385e218306c4ee5f46ba8d7649d2f81a7166b282232484
F src/btreeInt.h 91806f01fd1145a9a86ba3042f25c38d8faf6002701bf5e780742cf88bcff437
F src/build.c 7e4c835984afd813ab0511e6d2b6dad8e8dd8ecd227c58d589f36f15d588730f
F src/build.c f7070af66656b75be79a79a8ac720f4f0f8b48ba56298f2d9bf0f982d07ed949
F src/callback.c 88615dfc0a82167b65b452b4b305dbf86be77200b3343c6ffc6d03e92a01d181
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 1b0724e66f95f33b160b1af85caaf9cceb325d22abf39bd24df4f54a73982251
@ -486,7 +486,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c aa90da6540183b60e91886648678d1ab785276c2a1b35f5d6ac6939b8c44300c
F src/insert.c 54425efd1d2ce8715907d3df7341adc55173769b7b279f85c015bbeb36a82389
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 4ddc65ae13c0d93db0ceedc8b14a28c8c260513448b0eb8c5a2ac375e3b6a85d
F src/main.c 3e01f6a1c96643381b5f9d79e4ff7f2520bc5712197746fb0852283e78cccf66
@ -523,7 +523,7 @@ F src/pragma.h 40962d65b645bb3f08c1f4c456effd01c6e7f073f68ea25177e0c95e181cff75
F src/prepare.c 6049beb71385f017af6fc320d2c75a4e50b75e280c54232442b785fbb83df057
F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 2160146697e6e0ba251b5a954e16f542b6e684fb4778cec2994094ab401ef996
F src/resolve.c 9d6a3bdca1ebc759c4616fee0d7dd4cf62741f53db3a6b0117600f27c5b1406a
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c 9c81d168b5a7ddc2277a6f6d3daec9ddd0ff5cebf12628d7e342f3c337231e7e
F src/shell.c.in 3093bdf5eedd91da08f0268f1442aa510a60798c9441868149ddbecdf8bcaa79
@ -592,12 +592,12 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 7b17f6e2f20f6cbcb0b215025a86b7457c38451fc7622f705e553d7a488c572d
F src/treeview.c fddeb413159c3eeeaea3f496172f121cf3695606c461dc4e6dcee51417952df5
F src/trigger.c 845ccc08f60716c58aa28fe6470385c18ef8c4e1d88c93dcf449bc13d464eb2e
F src/update.c 3a5e1fa8e29413ee633f049bf9f0e1eb33a03a53cb55b6ea290120b324fbf46e
F src/update.c ae657f0db6a255011759ab9345ded7b54b828329a9dba04f94b4d4fa6e70e1ad
F src/upsert.c b445315c8958d8f17ec3297d06842e61dacaad0633ccaec1e4e160de7e562212
F src/utf.c 2f0fac345c7660d5c5bd3df9e9d8d33d4c27f366bcfb09e07443064d751a0507
F src/util.c 10d910e04a4f3842042485e0df01a484f57f912c10b60b3a09ccddd5019bd138
F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf
F src/vdbe.c 9a3f4c2ec6c45e4bd5db465e77e79dfdf5bdc5cf3a8c0bfe9549da209b9c18bc
F src/vdbe.c 9e4ba6bb8e5b827b9ae771ba62a92f3099adaacd36838d54042eb2499cd7f6f5
F src/vdbe.h b02904e1bd45c26fdf00c04844b9cfa825763aa5150b6d89ce88b8ab03581d0a
F src/vdbeInt.h bd589b8b7273286858950717e0e1ec5c88b18af45079a3366dc1371865cea704
F src/vdbeapi.c 1252d80c548711e47a6d84dae88ed4e95d3fbb4e7bd0eaa1347299af7efddf02
@ -1847,7 +1847,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 3de57145a18c62ff9b556c7218d8b276000d0052e4890212fa9335235f22d03c
R a55e27ef47378211556554247e39924e
P 812467fbf04ce00228a8381a5eee471e4e35cc63184a4538129fcd70b7cec979
R f0b4a76631d2a0cb79112ae41777ee3f
U drh
Z fccb2616701d2c5fa9e700807faeffc4
Z 9a9ae7faa8a1962c89b9945fd49858aa

View File

@ -1 +1 @@
812467fbf04ce00228a8381a5eee471e4e35cc63184a4538129fcd70b7cec979
30065716878d4058e75eb510b0b27b68e5193d04625eb173210de8061f20f499

View File

@ -1628,7 +1628,7 @@ void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){
u8 eType = COLFLAG_VIRTUAL;
Table *pTab = pParse->pNewTable;
Column *pCol;
if( pTab==0 ) goto generated_done;
if( NEVER(pTab==0) ) goto generated_done;
pCol = &(pTab->aCol[pTab->nCol-1]);
if( IN_DECLARE_VTAB ){
sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns");

View File

@ -857,13 +857,13 @@ void sqlite3Insert(
if( pColumn==0 && nColumn>0 ){
ipkColumn = pTab->iPKey;
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
if( pTab->tabFlags & TF_HasGenerated ){
if( ipkColumn>=0 && (pTab->tabFlags & TF_HasGenerated)!=0 ){
testcase( pTab->tabFlags & TF_HasVirtual );
testcase( pTab->tabFlags & TF_HasGenerated );
testcase( pTab->tabFlags & TF_HasStored );
for(i=ipkColumn-1; i>=0; i--){
if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){
testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL );
testcase( pTab->aCol[i].colFlags & COLFLAG_GENERATED );
testcase( pTab->aCol[i].colFlags & COLFLAG_STORED );
ipkColumn--;
}
}
@ -2413,10 +2413,39 @@ static int xferOptimization(
return 0; /* Neither table may have __hidden__ columns */
}
#endif
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
/* Even if tables t1 and t2 have identical schemas, if they contain
** generated columns, then this statement is semantically incorrect:
**
** INSERT INTO t2 SELECT * FROM t1;
**
** The reason is that generated column values are returned by the
** the SELECT statement on the right but the INSERT statement on the
** left wants them to be omitted.
**
** Nevertheless, this is a useful notational shorthand to tell SQLite
** to do a bulk transfer all of the content from t1 over to t2.
**
** We could, in theory, disable this (except for internal use by the
** VACUUM command where it is actually needed). But why do that? It
** seems harmless enough, and provides a useful service.
*/
if( (pDestCol->colFlags & COLFLAG_GENERATED) !=
(pSrcCol->colFlags & COLFLAG_GENERATED) ){
return 0; /* Both columns have the same generated type */
return 0; /* Both columns have the same generated-column type */
}
/* But the transfer is only allowed if both the source and destination
** tables have the exact same expressions for generated columns.
** This requirement could be relaxed for VIRTUAL columns, I suppose.
*/
if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){
if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){
testcase( pDestCol->colFlags & COLFLAG_VIRTUAL );
testcase( pDestCol->colFlags & COLFLAG_STORED );
return 0; /* Different generator expressions */
}
}
#endif
if( pDestCol->affinity!=pSrcCol->affinity ){
return 0; /* Affinity must be the same on all columns */
}
@ -2437,14 +2466,6 @@ static int xferOptimization(
return 0; /* Default values must be the same for all columns */
}
}
/* Generator expressions for generated columns must match */
if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){
if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){
testcase( pDestCol->colFlags & COLFLAG_VIRTUAL );
testcase( pDestCol->colFlags & COLFLAG_STORED );
return 0; /* Different generator expressions */
}
}
}
for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
if( IsUniqueIndex(pDestIdx) ){

View File

@ -633,7 +633,7 @@ static void notValid(
else if( pNC->ncFlags & NC_IsCheck ) zIn = "CHECK constraints";
#endif
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
else if( pNC->ncFlags & NC_GenCol ) zIn = "GENERATED ALWAYS AS columns";
else if( pNC->ncFlags & NC_GenCol ) zIn = "generated columns";
#endif
sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn);
}

View File

@ -314,8 +314,8 @@ void sqlite3Update(
}
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){
testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL );
testcase( pTab->aCol[i].colFlags & COLFLAG_STORED );
testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL );
testcase( pTab->aCol[j].colFlags & COLFLAG_STORED );
sqlite3ErrorMsg(pParse,
"cannot UPDATE generated column \"%s\"",
pTab->aCol[j].zName);

View File

@ -3375,7 +3375,6 @@ case OP_AutoCommit: {
p->rc = rc = SQLITE_BUSY;
goto vdbe_return;
}
assert( db->nStatement==0 );
sqlite3CloseSavepoints(db);
if( p->rc==SQLITE_OK ){
rc = SQLITE_DONE;