diff options
author | drh <> | 2024-06-14 23:13:54 +0000 |
---|---|---|
committer | drh <> | 2024-06-14 23:13:54 +0000 |
commit | 9175b18226948b05c4a6ed9b8a1c3225d3547544 (patch) | |
tree | 0c34368bfeecd089dd65f53232319d7a45948a24 /src/treeview.c | |
parent | 709cb313cf7b2da986ec2c0ca6510147ac702538 (diff) | |
download | sqlite-9175b18226948b05c4a6ed9b8a1c3225d3547544.tar.gz sqlite-9175b18226948b05c4a6ed9b8a1c3225d3547544.zip |
Do not omit the ORDER BY clause from a recursive CTE just because the
query that contains the CTE also contains an ORDER BY clause. Plus
other changes imported from the recursive-cte-orderby-fix branch.
FossilOrigin-Name: 13242289c5d412b706f50fc7e1553032ea3a52d41a3e34e155432adaf0551481
Diffstat (limited to 'src/treeview.c')
-rw-r--r-- | src/treeview.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/treeview.c b/src/treeview.c index 4dcc130cd..054265338 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -901,9 +901,10 @@ void sqlite3TreeViewBareExprList( sqlite3TreeViewLine(pView, "%s", zLabel); for(i=0; i<pList->nExpr; i++){ int j = pList->a[i].u.x.iOrderByCol; + u8 sortFlags = pList->a[i].fg.sortFlags; char *zName = pList->a[i].zEName; int moreToFollow = i<pList->nExpr - 1; - if( j || zName ){ + if( j || zName || sortFlags ){ sqlite3TreeViewPush(&pView, moreToFollow); moreToFollow = 0; sqlite3TreeViewLine(pView, 0); @@ -924,13 +925,18 @@ void sqlite3TreeViewBareExprList( } } if( j ){ - fprintf(stdout, "iOrderByCol=%d", j); + fprintf(stdout, "iOrderByCol=%d ", j); + } + if( sortFlags & KEYINFO_ORDER_DESC ){ + fprintf(stdout, "DESC "); + }else if( sortFlags & KEYINFO_ORDER_BIGNULL ){ + fprintf(stdout, "NULLS-LAST"); } fprintf(stdout, "\n"); fflush(stdout); } sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow); - if( j || zName ){ + if( j || zName || sortFlags ){ sqlite3TreeViewPop(&pView); } } |