diff options
author | drh <> | 2024-05-21 11:11:29 +0000 |
---|---|---|
committer | drh <> | 2024-05-21 11:11:29 +0000 |
commit | b8337932b36e85b85f9fc8efc4b141371078c119 (patch) | |
tree | 6c1491d8c3b0f6eca328b2e8dc8bcd518ce54ca8 /src/json.c | |
parent | 00208479fd4c371eec868cadb6b9968fd9045fb8 (diff) | |
download | sqlite-b8337932b36e85b85f9fc8efc4b141371078c119.tar.gz sqlite-b8337932b36e85b85f9fc8efc4b141371078c119.zip |
Fix the -> and ->> operators so that when the RHS is a string that looks like
a number, it is still treated as a string, because that is what PG does.
[forum:/forumpost/9e52cdfe15c3926e|Forum post 9e52cdfe15c3926e].
FossilOrigin-Name: de8182cf1773ac0d04268d896a613841cf6bf61f9f030342170657d5e06f2acb
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/json.c b/src/json.c index 44ae84646..4db468c92 100644 --- a/src/json.c +++ b/src/json.c @@ -3795,13 +3795,6 @@ static void jsonArrayLengthFunc( jsonParseFree(p); } -/* True if the string is all digits */ -static int jsonAllDigits(const char *z, int n){ - int i; - for(i=0; i<n && sqlite3Isdigit(z[i]); i++){} - return i==n; -} - /* True if the string is all alphanumerics and underscores */ static int jsonAllAlphanum(const char *z, int n){ int i; @@ -3866,7 +3859,7 @@ static void jsonExtractFunc( ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience */ jsonStringInit(&jx, ctx); - if( jsonAllDigits(zPath, nPath) ){ + if( sqlite3_value_type(argv[i])==SQLITE_INTEGER ){ jsonAppendRawNZ(&jx, "[", 1); jsonAppendRaw(&jx, zPath, nPath); jsonAppendRawNZ(&jx, "]", 2); |