1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix the column name uniquifier so that it works with zero-length column names.

FossilOrigin-Name: 791761ebac26c82ab67bdf867117ec5b5d8b20b0
This commit is contained in:
drh
2015-11-15 11:13:49 +00:00
parent 96ceaf8680
commit f7ee8965a5
3 changed files with 11 additions and 9 deletions

View File

@@ -1651,8 +1651,10 @@ int sqlite3ColumnsFromExprList(
cnt = 0;
while( zName && sqlite3HashFind(&ht, zName)!=0 ){
nName = sqlite3Strlen30(zName);
for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}
if( zName[j]==':' ) nName = j;
if( nName>0 ){
for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}
if( zName[j]==':' ) nName = j;
}
zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt);
if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);
}