One of two options on how to address ticket [61c853857f40da49]. In this

mode, we back out the documentation change of
[https://www.sqlite.org/docsrc/info/07b7749da88d54e5|[07b7749da88d54e5]]
and change the core to work as it has been documented to work since 2017,
rather than how it has actually worked since 2009.

FossilOrigin-Name: 09cd0c0c6e6c963e0039a733876e5149adb3cd10e9b92699fa1dcb0633e997a4
This commit is contained in:
drh 2019-08-05 19:32:06 +00:00
parent 1194904b81
commit 81506b88b8
7 changed files with 34 additions and 28 deletions

View File

@ -1,5 +1,5 @@
C Refactor\sfield\sExpr.affinity\sinto\sExpr.affExpr\sto\savoid\sconfusion\swith\sother\nfields\sand\svariables\snamed\s"affinity"\sand\sdisplay\saffExpr\sit\sin\nsqlite3TreeViewExpr()\soutput.
D 2019-08-05T18:01:42.394
C One\sof\stwo\soptions\son\show\sto\saddress\sticket\s[61c853857f40da49].\s\sIn\sthis\nmode,\swe\sback\sout\sthe\sdocumentation\schange\sof\n[https://www.sqlite.org/docsrc/info/07b7749da88d54e5|[07b7749da88d54e5]]\nand\schange\sthe\score\sto\swork\sas\sit\shas\sbeen\sdocumented\sto\swork\ssince\s2017,\nrather\sthan\show\sit\shas\sactually\sworked\ssince\s2009.
D 2019-08-05T19:32:06.820
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -467,7 +467,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 397b5075441d0bd7366e93f6f2ef908dd0610cd80c4e351f4a900b614e32ccf0
F src/btree.h c11446f07ec0e9dc85af8041cb0855c52f5359c8b2a43e47e02a685282504d89
F src/btreeInt.h 6111c15868b90669f79081039d19e7ea8674013f907710baa3c814dc3f8bfd3f
F src/build.c 48f22e7c3b80550eb9c0cc3a3738f9117109b87d5f5fdba027009b7f2917df4a
F src/build.c b48552e607494b914ce45cb82ffde58d1cee3cf240529abdcb7d6445803b5fa5
F src/callback.c 25dda5e1c2334a367b94a64077b1d06b2553369f616261ca6783c48bcb6bda73
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 37f3d21193c4f7d141d0691cced5b39c99951bfef78df9887faf9167b9c42f37
@ -484,7 +484,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 f20925c2c08144442dabeb73dcd0f5026f5f085d827f3d5635f7c45e5d195320
F src/insert.c ea7e0c3dae74ba766967deabc3112d77e36cb9230245b0cf422051886c911af5
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 22afc33c3a61b4fd80a60a54f1882688371e6bc64685df2696b008fce65a999c
F src/main.c ddba2dd3c8b11ad1d2ecc146a85a459c50a9a6b592ff154246a5db44d601d64f
@ -523,12 +523,12 @@ F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 3ed5a3de18b455366771a89241283fef16508a7f681af546296e95e81458efeb
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c 1b8b5afee76e7d662b34c61705a638f7a6a20d5109515ca973c12343c84fb2d6
F src/select.c 5b0ef2a8b392fad19d1c8ceb803ab82a2e5ddf34d7f138cabb0a00d0a4c9d646
F src/shell.c.in e5351f14716065d6e00a0437d3910cbb1a9d4fa96af61f59f18e5623679fe605
F src/sqlite.h.in dfe86c132b5085e00cf0539c78510b75e60d740191804c9848e8bb7aa850fff5
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 9ecc93b8493bd20c0c07d52e2ac0ed8bab9b549c7f7955b59869597b650dd8b5
F src/sqliteInt.h 67de168774b2fcc8db9d4f30448ca57f2e569f4291e229819afd68e77b910bad
F src/sqliteInt.h 6350fc633ada5484a6db345fb0f29d76ceb0c471e3713a07acad65d697975bda
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@ -613,7 +613,7 @@ F src/where.c dee31d6842a8f6acd54bc7a7c2505050cd0fa52228634187195bc0b64eb9c240
F src/whereInt.h 2bb9632f90a1a32952d43a52587209cdd536c3548715d7859bf0c1f9a65a2efd
F src/wherecode.c 5dd20651afc1f67bad35523514e87f017295f1cddfdf5d1ea31a8e299d7054a8
F src/whereexpr.c 5e559bdd24b06e3bc2e68f258bf751302954dc1e432daf71fdd8098a71462326
F src/window.c 7728ba7a3d44084a44eefb60464a88fb2ff035eb20cdeb1160ae65ac3c0be6b9
F src/window.c 8da008a1a6f4db73e1462e88fadb2e05809bd557e4e40d1c37339fecc8b998c1
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
@ -1838,7 +1838,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 4b00799bdf107fce8a9dd84fd5bf6597e4f3373659b89aae4a1242be5964726f
R dacf57e6b8446ef98d2c115e292d46f4
P a29f2a7d07beff64e489e8f824babc6228c4a499fadc0ee701caa60a63baadcd
R 97414c81c0b4f69819c6816648005997
T *branch * tkt-61c853-A
T *sym-tkt-61c853-A *
T -sym-trunk *
U drh
Z ee2588e2d826992a9f3fe3e7ef29d6ef
Z 92b9b582014c94f15af3528987c407cd

View File

@ -1 +1 @@
a29f2a7d07beff64e489e8f824babc6228c4a499fadc0ee701caa60a63baadcd
09cd0c0c6e6c963e0039a733876e5149adb3cd10e9b92699fa1dcb0633e997a4

View File

@ -2160,7 +2160,7 @@ void sqlite3EndTable(
addrTop = sqlite3VdbeCurrentAddr(v) + 1;
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
if( pParse->nErr ) return;
pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect);
pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB);
if( pSelTab==0 ) return;
assert( p->aCol==0 );
p->nCol = pSelTab->nCol;
@ -2424,10 +2424,10 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
#ifndef SQLITE_OMIT_AUTHORIZATION
xAuth = db->xAuth;
db->xAuth = 0;
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, 0);
db->xAuth = xAuth;
#else
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, 0);
#endif
pParse->nTab = n;
if( pTable->pCheck ){
@ -2443,7 +2443,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
&& pParse->nErr==0
&& pTable->nCol==pSel->pEList->nExpr
){
sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel);
sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, 0);
}
}else if( pSelTab ){
/* CREATE VIEW name AS... without an argument list. Construct

View File

@ -88,19 +88,19 @@ const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
}
for(n=0; n<pIdx->nColumn; n++){
i16 x = pIdx->aiColumn[n];
if( x>=0 ){
pIdx->zColAff[n] = pTab->aCol[x].affinity;
}else if( x==XN_ROWID ){
pIdx->zColAff[n] = SQLITE_AFF_INTEGER;
}else{
char aff;
if( x>=0 ){
aff = pTab->aCol[x].affinity;
}else if( x==XN_ROWID ){
aff = SQLITE_AFF_INTEGER;
}else{
assert( x==XN_EXPR );
assert( pIdx->aColExpr!=0 );
aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
}
if( aff==0 ) aff = SQLITE_AFF_BLOB;
pIdx->zColAff[n] = aff;
}
}
pIdx->zColAff[n] = 0;
}

View File

@ -2035,7 +2035,8 @@ int sqlite3ColumnsFromExprList(
void sqlite3SelectAddColumnTypeAndCollation(
Parse *pParse, /* Parsing contexts */
Table *pTab, /* Add column type information to this table */
Select *pSelect /* SELECT used to determine types and collations */
Select *pSelect, /* SELECT used to determine types and collations */
char aff /* Default affinity for columns */
){
sqlite3 *db = pParse->db;
NameContext sNC;
@ -2068,7 +2069,7 @@ void sqlite3SelectAddColumnTypeAndCollation(
pCol->colFlags |= COLFLAG_HASTYPE;
}
}
if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
if( pCol->affinity==0 ) pCol->affinity = aff;
pColl = sqlite3ExprCollSeq(pParse, p);
if( pColl && pCol->zColl==0 ){
pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
@ -2081,7 +2082,7 @@ void sqlite3SelectAddColumnTypeAndCollation(
** Given a SELECT statement, generate a Table structure that describes
** the result set of that SELECT.
*/
Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){
Table *pTab;
sqlite3 *db = pParse->db;
u64 savedFlags;
@ -2101,7 +2102,7 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
pTab->zName = 0;
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect, aff);
pTab->iPKey = -1;
if( db->mallocFailed ){
sqlite3DeleteTable(db, pTab);
@ -5195,7 +5196,9 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
Select *pSel = pFrom->pSelect;
if( pSel ){
while( pSel->pPrior ) pSel = pSel->pPrior;
sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel);
sqlite3SelectAddColumnTypeAndCollation(
pParse, pTab, pSel, SQLITE_AFF_BLOB
);
}
}
}

View File

@ -3911,8 +3911,8 @@ void sqlite3CollapseDatabaseArray(sqlite3*);
void sqlite3CommitInternalChanges(sqlite3*);
void sqlite3DeleteColumnNames(sqlite3*,Table*);
int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);
void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*);
Table *sqlite3ResultSetOfSelect(Parse*,Select*);
void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*,char);
Table *sqlite3ResultSetOfSelect(Parse*,Select*,char);
void sqlite3OpenMasterTable(Parse *, int);
Index *sqlite3PrimaryKeyIndex(Table*);
i16 sqlite3ColumnOfIndex(Index*, i16);

View File

@ -994,7 +994,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
p->pSrc->a[0].pSelect = pSub;
sqlite3SrcListAssignCursors(pParse, p->pSrc);
pSub->selFlags |= SF_Expanded;
pTab2 = sqlite3ResultSetOfSelect(pParse, pSub);
pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_BLOB);
if( pTab2==0 ){
rc = SQLITE_NOMEM;
}else{