diff options
author | drh <> | 2021-03-20 15:46:01 +0000 |
---|---|---|
committer | drh <> | 2021-03-20 15:46:01 +0000 |
commit | 2f2091b10e28fc76a9c30e084a4eb2c466a75674 (patch) | |
tree | e20873f113d38b088fc5ee2350472edd196c2186 /src | |
parent | 8210233c7b963c391ce5f7d636ef453d5ab78bd9 (diff) | |
download | sqlite-2f2091b10e28fc76a9c30e084a4eb2c466a75674.tar.gz sqlite-2f2091b10e28fc76a9c30e084a4eb2c466a75674.zip |
Use the canonical name, not the AS name, when showing the MATERIALIZE or
CO-ROUTINE lines for a CTE.
FossilOrigin-Name: 1b83e232c490fe6e9f999d30399faebfac6094bf940dc21dc459ed2c97657cb2
Diffstat (limited to 'src')
-rw-r--r-- | src/printf.c | 6 | ||||
-rw-r--r-- | src/wherecode.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/printf.c b/src/printf.c index 48382143b..6f3b5681a 100644 --- a/src/printf.c +++ b/src/printf.c @@ -102,7 +102,7 @@ static const et_info fmtinfo[] = { /* Notes: ** ** %S Takes a pointer to SrcItem. Shows name or database.name -** %!S Like %S but also shows AS alias if an alias is available +** %!S Like %S but prefer the zName over the zAlias */ /* Floating point constants used for rounding */ @@ -864,7 +864,7 @@ void sqlite3_str_vappendf( if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; pItem = va_arg(ap, SrcItem*); assert( bArgList==0 ); - if( pItem->zAlias ){ + if( pItem->zAlias && !flag_altform2 ){ sqlite3_str_appendall(pAccum, pItem->zAlias); }else if( pItem->zName ){ if( pItem->zDatabase ){ @@ -872,6 +872,8 @@ void sqlite3_str_vappendf( sqlite3_str_append(pAccum, ".", 1); } sqlite3_str_appendall(pAccum, pItem->zName); + }else if( pItem->zAlias ){ + sqlite3_str_appendall(pAccum, pItem->zAlias); }else if( pItem->pSelect ){ sqlite3_str_appendf(pAccum, "SUBQUERY %u", pItem->pSelect->selId); } diff --git a/src/wherecode.c b/src/wherecode.c index 195c08de3..771a50fc7 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -149,7 +149,7 @@ int sqlite3WhereExplainOneScan( sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); str.printfFlags = SQLITE_PRINTF_INTERNAL; - sqlite3_str_appendf(&str, "%s %!S", isSearch ? "SEARCH" : "SCAN", pItem); + sqlite3_str_appendf(&str, "%s %S", isSearch ? "SEARCH" : "SCAN", pItem); if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){ const char *zFmt = 0; Index *pIdx; |