aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <>2022-04-18 00:04:15 +0000
committerdrh <>2022-04-18 00:04:15 +0000
commitd0453f7ec53693c32b058909ebb3d954ffe0c054 (patch)
treed7ef1f8ed1c2c073d873a29668dc17b94cbf85f7 /src/select.c
parenta3e2518bb349d9f635ac3599e2f39cc733d2ad44 (diff)
downloadsqlite-d0453f7ec53693c32b058909ebb3d954ffe0c054.tar.gz
sqlite-d0453f7ec53693c32b058909ebb3d954ffe0c054.zip
When converting a NATURAL JOIN into a JOIN USING, make sure to insert the
name correctly into the IdList even if it is a wierd quoted name. FossilOrigin-Name: e62156b696f2496e2697cb3b46f136551b58644e2a5824aa3d759596694b2f4b
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/select.c b/src/select.c
index db4117209..b41a44cff 100644
--- a/src/select.c
+++ b/src/select.c
@@ -483,10 +483,12 @@ static int sqlite3ProcessJoin(Parse *pParse, Select *p){
if( IsHiddenColumn(&pRightTab->aCol[j]) ) continue;
zName = pRightTab->aCol[j].zCnName;
if( tableAndColumnIndex(pSrc, 0, i, zName, 0, 0, 1) ){
- Token x;
- x.z = zName;
- x.n = sqlite3Strlen30(zName);
- pUsing = sqlite3IdListAppend(pParse, pUsing, &x);
+ pUsing = sqlite3IdListAppend(pParse, pUsing, 0);
+ if( pUsing ){
+ assert( pUsing->nId>0 );
+ assert( pUsing->a[pUsing->nId-1].zName==0 );
+ pUsing->a[pUsing->nId-1].zName = sqlite3DbStrDup(pParse->db, zName);
+ }
}
}
if( pUsing ){