1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

When constructing the synthensized SELECT statement that is used to choose

the rows in an UPDATE FROM, make sure the first table is really the table
being updated, and not some common-table expression that happens to have the
same name.  [forum:/forumpost/a274248080|forum post a274248080].  More
changes associated with CTE name resolution are pending.

FossilOrigin-Name: 0f0959c6f95046e8e7887716e0a7de95da18d1e926ab1f919527083a56541db5
This commit is contained in:
drh
2021-05-19 21:55:56 +00:00
parent 1f4f7c7a41
commit 1168f81092
4 changed files with 13 additions and 9 deletions

View File

@@ -220,6 +220,10 @@ static void updateFromSelect(
assert( pTabList->nSrc>1 );
if( pSrc ){
if( pSrc->a[0].zDatabase==0 ){
int iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
pSrc->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iSchema].zDbSName);
}
pSrc->a[0].iCursor = -1;
pSrc->a[0].pTab->nTabRef--;
pSrc->a[0].pTab = 0;