aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-11-15 11:13:49 +0000
committerdrh <drh@noemail.net>2015-11-15 11:13:49 +0000
commitf7ee8965a5f36fd6dbd9469784ab6e539cea950d (patch)
tree819eb3288defc216e25f28d692bb912755e125a2 /src
parent96ceaf8680363bb14919c04f3a2ae0c0054868f1 (diff)
downloadsqlite-f7ee8965a5f36fd6dbd9469784ab6e539cea950d.tar.gz
sqlite-f7ee8965a5f36fd6dbd9469784ab6e539cea950d.zip
Fix the column name uniquifier so that it works with zero-length column names.
FossilOrigin-Name: 791761ebac26c82ab67bdf867117ec5b5d8b20b0
Diffstat (limited to 'src')
-rw-r--r--src/select.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index 2265d4c9f..126d4cc28 100644
--- a/src/select.c
+++ b/src/select.c
@@ -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);
}