diff options
author | drh <> | 2022-12-09 17:33:21 +0000 |
---|---|---|
committer | drh <> | 2022-12-09 17:33:21 +0000 |
commit | e974e73f69adc314367b4c26f9d0c6fc0163fa23 (patch) | |
tree | 9065dad59bb40cf9019e174b5c5f55cacc164d6f /src | |
parent | a60d61bf14ef0aadeabaaebea7fdfd53121c1b1d (diff) | |
download | sqlite-e974e73f69adc314367b4c26f9d0c6fc0163fa23.tar.gz sqlite-e974e73f69adc314367b4c26f9d0c6fc0163fa23.zip |
Do not allow OOM faults in EQP messages associated with automatic indexes
on co-routines to go unreported.
FossilOrigin-Name: d125d5afdf1b0a1c64fc64f180898099af07b8290ea9da49419df75d8b455f71
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/where.c b/src/where.c index 25ad18b28..d3e04808f 100644 --- a/src/where.c +++ b/src/where.c @@ -836,7 +836,8 @@ static void explainAutomaticIndex( const char *zSep = ""; char *zText = 0; int ii = 0; - zText = sqlite3_mprintf("CREATE AUTOMATIC INDEX ON %s(", pTab->zName); + sqlite3_str *pStr = sqlite3_str_new(pParse->db); + sqlite3_str_appendf(pStr,"CREATE AUTOMATIC INDEX ON %s(", pTab->zName); assert( pIdx->nColumn>1 ); assert( pIdx->aiColumn[pIdx->nColumn-1]==XN_ROWID ); for(ii=0; ii<(pIdx->nColumn-1); ii++){ @@ -844,13 +845,18 @@ static void explainAutomaticIndex( int iCol = pIdx->aiColumn[ii]; zName = pTab->aCol[iCol].zCnName; - zText = sqlite3_mprintf("%z%s%s", zText, zSep, zName); + sqlite3_str_appendf(pStr, "%s%s", zSep, zName); zSep = ", "; } - *pAddrExplain = sqlite3VdbeExplain( - pParse, 0, "%s)%s", zText, (bPartial ? " WHERE <expr>" : "") - ); - sqlite3_free(zText); + zText = sqlite3_str_finish(pStr); + if( zText==0 ){ + sqlite3OomFault(pParse->db); + }else{ + *pAddrExplain = sqlite3VdbeExplain( + pParse, 0, "%s)%s", zText, (bPartial ? " WHERE <expr>" : "") + ); + sqlite3_free(zText); + } } } #else |