Further tests and assert() statements for the change on this branch.

FossilOrigin-Name: 1c202d540ac362bfc747a9f8472e83c9d7614e38467f8b48787a669fb34664ba
This commit is contained in:
dan 2023-09-16 14:42:18 +00:00
parent 63702bccaa
commit 2e8edc1d45
4 changed files with 49 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Fix\sresolution\sof\sunqualified\s"rowid"\sidentifiers\sin\squeries\swith\snested\sjoins.
D 2023-09-15T20:57:05.776
C Further\stests\sand\sassert()\sstatements\sfor\sthe\schange\son\sthis\sbranch.
D 2023-09-16T14:42:18.058
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -708,7 +708,7 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c 80548297dc0e1fb3139cdebffb5a1bcac3dfac66d791012dd74838e70445072d
F src/printf.c e3ba080e2f409f9bfcc8d34724e6fc160e9c718dc92d0548f6b71b8b6f860ce2
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 1cbb3dacd41882dabe07209242d015f100d36cfb685235278b1d4e15711017b7
F src/resolve.c 2aaa1d5c69f40529951efe4901263e2b82bc95e3e3248088a7a4c887db740bdc
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 5e9ff0eb38e5341780a70e3a39ea1d447c237552d1f552416dc605c123bf2acd
F src/shell.c.in 62708bea44d4e43aa7b1270ed422d1d29e82297924d4e0f223c39336a3f582f8
@ -1290,7 +1290,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2
F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28
F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b
F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127
F test/joinH.test 832a33079ee8fba7e33fa5ac77c481b3fd8399ba16362d4524a0be22a060b9f2
F test/joinH.test 5f6107246b8509f9df4745fbdc2107a16f07594770a5c473a25f6c7f672edd86
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
@ -2121,8 +2121,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 59a1bbc69f5dbb33418fa4b383393fb13a46bc1e531577da8ad54ae2fad5a10e
R 790b7202228cf2f5b7a7a80533c697dd
P bbcbd3d537d6790373d97f59386b8ce7fa2177db572af0f1babe058a76e25cc3
R bf57b361beb0f7cbd2e152c6af93c51b
U dan
Z ce4b0349e1c5a42e7e7210175df9fc25
Z 9359045b06de790036a380b27c8df205
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
bbcbd3d537d6790373d97f59386b8ce7fa2177db572af0f1babe058a76e25cc3
1c202d540ac362bfc747a9f8472e83c9d7614e38467f8b48787a669fb34664ba

View File

@ -282,7 +282,7 @@ static int lookupName(
){
int i, j; /* Loop counters */
int cnt = 0; /* Number of matching column names */
int cntTab = 0; /* Number of matching table names */
int cntTab = 0; /* Number of potential "rowid" matches */
int nSubquery = 0; /* How many levels of subquery */
sqlite3 *db = pParse->db; /* The database connection */
SrcItem *pItem; /* Use for looping over pSrcList items */
@ -391,12 +391,17 @@ static int lookupName(
cnt++;
hit = 1;
}else if( cnt>0 ){
/* This is a potential rowid match, but there has already been
** a real match found. So this can be ignored. */
continue;
}
cntTab++;
pMatch = pItem;
pExpr->iColumn = j;
pEList->a[j].fg.bUsed = 1;
/* rowid cannot be part of a USING clause - assert() this. */
assert( bRowid==0 || pEList->a[j].fg.bUsingTerm==0 );
if( pEList->a[j].fg.bUsingTerm ) break;
}
if( hit || zTab==0 ) continue;

View File

@ -211,15 +211,44 @@ do_catchsql_test 9.3 {
do_catchsql_test 9.4 {
SELECT a FROM wo1, x1, x2;
} {1 {ambiguous column name: a}}
# It is not possible to use "rowid" in a USING clause.
#
do_catchsql_test 9.5 {
SELECT rowid FROM x1 JOIN (x2 JOIN wo2);
} {0 {}}
SELECT * FROM x1 JOIN x2 USING (rowid);
} {1 {cannot join using column rowid - column not present in both tables}}
do_catchsql_test 9.6 {
SELECT * FROM wo2 JOIN x2 USING (rowid);
} {1 {cannot join using column rowid - column not present in both tables}}
# "rowid" columns are not matched by NATURAL JOIN. If they were, then
# the SELECT below would return zero rows.
do_execsql_test 9.7 {
INSERT INTO x1(rowid, a) VALUES(101, 'A');
INSERT INTO x2(rowid, b) VALUES(55, 'B');
SELECT * FROM x1 NATURAL JOIN x2;
} {A B}
do_execsql_test 9.8 {
INSERT INTO wo1(a, b) VALUES('mya', 'myb');
INSERT INTO wo2(a, rowid) VALUES('mypk', 'myrowid');
INSERT INTO wo3(a, b) VALUES('MYA', 'MYB');
INSERT INTO x3(rowid, c) VALUES(99, 'x3B');
}
do_catchsql_test 9.8 {
SELECT rowid FROM x1 JOIN (x2 JOIN wo2);
} {0 myrowid}
do_catchsql_test 9.9 {
SELECT _rowid_ FROM wo1 JOIN (wo3 JOIN x3)
} {0 {}}
} {0 99}
do_catchsql_test 9.10 {
SELECT oid FROM wo1 JOIN (wo3 JOIN x3)
} {0 99}
do_catchsql_test 9.11 {
SELECT oid FROM wo2 JOIN (wo3 JOIN x3)
} {0 99}
finish_test