aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2023-01-17 15:46:27 +0000
committerdan <Dan Kennedy>2023-01-17 15:46:27 +0000
commit19ab86f3ffeed87096c78dfe1ddcef10126526ca (patch)
tree89f40318f9036b0a87aea3cd250a707e24eceb46 /src/json.c
parentc37af308faa80890b38fc2db5fd154d575cb308b (diff)
downloadsqlite-19ab86f3ffeed87096c78dfe1ddcef10126526ca.tar.gz
sqlite-19ab86f3ffeed87096c78dfe1ddcef10126526ca.zip
Update virtual tables json_each and json_tree so that adding "ORDER BY rowid" to a query does not require an external sort.
FossilOrigin-Name: ce18f0ed684824e67ed6c09acab8e735fef2c52b2ed32270dee1a2a67802c59b
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/json.c b/src/json.c
index 3636d3665..7f6d5a4ab 100644
--- a/src/json.c
+++ b/src/json.c
@@ -2473,6 +2473,13 @@ static int jsonEachBestIndex(
idxMask |= iMask;
}
}
+ if( pIdxInfo->nOrderBy>0
+ && pIdxInfo->aOrderBy[0].iColumn<0
+ && pIdxInfo->aOrderBy[0].desc==0
+ ){
+ pIdxInfo->orderByConsumed = 1;
+ }
+
if( (unusableMask & ~idxMask)!=0 ){
/* If there are any unusable constraints on JSON or ROOT, then reject
** this entire plan */