]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The previous check-in was not quite correct, and introduced a new problem
authordrh <drh@noemail.net>
Mon, 9 Dec 2019 18:22:17 +0000 (18:22 +0000)
committerdrh <drh@noemail.net>
Mon, 9 Dec 2019 18:22:17 +0000 (18:22 +0000)
with the USING clause.  Use this version instead.

FossilOrigin-Name: ed28aaa4851202111a502f883ca06359d89b25bba4055c29d7bce2b501cfcc68

manifest
manifest.uuid
src/resolve.c
test/gencol1.test

index 0282d726ca9b669e4fb5121bd29cc5c907acb2ca..e8e37c2f379bb108c0520e1654e8c2a73123d623 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Ensure\sthat\sthe\sSrcList_item.colUsed\sfield\sis\sset\scorrectly\s(set\sto\shave\sa\n1\sfor\sall\scolumns\sof\sthe\stable)\swhen\sa\sgenerated\scolumn\sappears\sin\sthe\sUSING\nclause\sof\sa\sjoin.
-D 2019-12-09T17:14:48.320
+C The\sprevious\scheck-in\swas\snot\squite\scorrect,\sand\sintroduced\sa\snew\sproblem\nwith\sthe\sUSING\sclause.\s\sUse\sthis\sversion\sinstead.
+D 2019-12-09T18:22:17.430
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -525,7 +525,7 @@ F src/pragma.h ec3b31eac9b1df040f1cc8cb3d89bc06605c3b4cb3d76f833de8d6d6c3f77f04
 F src/prepare.c 6049beb71385f017af6fc320d2c75a4e50b75e280c54232442b785fbb83df057
 F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
-F src/resolve.c 32b5adb26c21be0dcf7d639053f10f1a34a0a4ae10f59dd9c5b71f8d1579e76b
+F src/resolve.c 5b36f3e5185828514a9819b17ba12c2a90d7533c6480e9c132af2a15dc873f51
 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
 F src/select.c 0fe10579de20eb8dc04ec9ed29659fa782bee2bcc85a35734637f3e2cabc2762
 F src/shell.c.in 4a3a9e1c11847b1904f2b01d087af1c052f660902755abab457cab1756817ded
@@ -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 891f9ac3a3acf27902767020b8667ba6168306f3f226e5c036c442caffd06dd7
+F test/gencol1.test aab394862d6c14a57ff488b0ef3413ed9f3067a56955ede25b5e059188a66a41
 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 f3b39c71b88cb6721f443de56cdce4c08252453a5e340b00a2bd88dc10c42400
-R 4c75b826224c9334b1247cab793c4dea
+P 1923efb283e8840fa7436eb20b9d2174ef7cace1690d3b97b572a0db2048b8e3
+R a96cd4b8228ca22846e956b515f7f936
 U drh
-Z 46d53a02a606d9b97d8ca0a567728aa1
+Z be59f8e80c6d9c48ccfec27ec78b01a5
index 0dec8cbdc65d511b918f7231f11f823eee994b91..2c0b8b2983546a141d1b8559e301ae5ce8b03f32 100644 (file)
@@ -1 +1 @@
-1923efb283e8840fa7436eb20b9d2174ef7cace1690d3b97b572a0db2048b8e3
\ No newline at end of file
+ed28aaa4851202111a502f883ca06359d89b25bba4055c29d7bce2b501cfcc68
\ No newline at end of file
index 5c01df4f8c3a608b1d582fb6e43290fd1152e7c6..e8e735aec8cad1786f5f6e973e74eadf3ffdf98d 100644 (file)
@@ -566,26 +566,21 @@ static int lookupName(
   if( pExpr->iColumn>=0 && pMatch!=0 ){
     int n = pExpr->iColumn;
     Table *pTab;
-    testcase( n==BMS-1 );
-    if( n>=BMS ){
-      n = BMS-1;
-    }
     pTab = pExpr->y.pTab;
     assert( pTab!=0 );
     assert( pMatch->iCursor==pExpr->iTable );
-    if( pTab->tabFlags & TF_HasGenerated ){
-      Column *pColumn = pTab->aCol + pExpr->iColumn;
-      if( pColumn->colFlags & COLFLAG_GENERATED ){
-        testcase( pTab->nCol==63 );
-        testcase( pTab->nCol==64 );
-        if( pTab->nCol>=64 ){
-          pMatch->colUsed = ALLBITS;
-        }else{
-          pMatch->colUsed = MASKBIT(pTab->nCol)-1;
-        }
-      }
+    if( (pTab->tabFlags & TF_HasGenerated)!=0
+     && (pTab->aCol[n].colFlags & COLFLAG_GENERATED)!=0 
+    ){
+      testcase( pTab->nCol==BMS-1 );
+      testcase( pTab->nCol==BMS );
+      pMatch->colUsed = pTab->nCol>=BMS ? ALLBITS : MASKBIT(pTab->nCol)-1;
+    }else{
+      testcase( n==BMS-1 );
+      testcase( n==BMS );
+      if( n>=BMS ) n = BMS-1;
+      pMatch->colUsed |= ((Bitmask)1)<<n;
     }
-    pMatch->colUsed |= ((Bitmask)1)<<n;
   }
 
   /* Clean up and return
@@ -630,17 +625,12 @@ Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
       p->iColumn = -1;
     }else{
       p->iColumn = (ynVar)iCol;
-      if( pTab->tabFlags & TF_HasGenerated ){
-        Column *pColumn = pTab->aCol + iCol;
-        if( pColumn->colFlags & COLFLAG_GENERATED ){
-          testcase( pTab->nCol==63 );
-          testcase( pTab->nCol==64 );
-          if( pTab->nCol>=64 ){
-            pItem->colUsed = ALLBITS;
-          }else{
-            pItem->colUsed = MASKBIT(pTab->nCol)-1;
-          }
-        }
+      if( (pTab->tabFlags & TF_HasGenerated)!=0
+       && (pTab->aCol[iCol].colFlags & COLFLAG_GENERATED)!=0
+      ){
+        testcase( pTab->nCol==63 );
+        testcase( pTab->nCol==64 );
+        pItem->colUsed = pTab->nCol>=64 ? ALLBITS : MASKBIT(pTab->nCol)-1;
       }else{
         testcase( iCol==BMS );
         testcase( iCol==BMS-1 );
index 1a45767608114923ce7d8120b797af2a77c702d4..dbcfefe61ef0aa349bcc4fe3ece38b3a69e05d54 100644 (file)
@@ -352,9 +352,22 @@ do_execsql_test gencol1-13.10 {
   SELECT y FROM t1 JOIN t1 USING (y,y);
 } {11}
 do_execsql_test gencol1-13.11 {
+  SELECT 123 FROM t1 JOIN t1 USING (x);
+} {123}
+do_execsql_test gencol1-13.11 {
+  SELECT 456 FROM t1 JOIN t1 USING (x,x);
+} {456}
+do_execsql_test gencol1-13.20 {
   CREATE INDEX t1y ON t1(y);
   SELECT y FROM t1 JOIN t1 USING (y,y);
 } {11}
+do_execsql_test gencol1-13.21 {
+  CREATE INDEX t1x ON t1(x);
+  SELECT 123 FROM t1 JOIN t1 USING (x);
+} {123}
+do_execsql_test gencol1-13.22 {
+  SELECT 456 FROM t1 JOIN t1 USING (x,x);
+} {456}
 
 
 finish_test