SQLite Forum

[bug] JSON extraction fails with PostgreSQL-style path referring to numeric string name
Login

[bug] JSON extraction fails with PostgreSQL-style path referring to numeric string name

(1.1) By Mark Brand (mabrand) on 2024-05-14 11:58:49 edited from 1.0 [source]

Hi,

Extraction of a PostgresSQL-style path fails when it refers to a name consisting only of numeric characters, as in the 3rd example below:

--Returns "one" as expected
SELECT json_extract('{"1":"one"}', '$.1');

--MySQL-style returns "one" as expected
SELECT '{"1":"one"}' -> '$.1';

--PostgreSQL-style unexpectedly returns NULL
SELECT '{"1":"one"}' -> '1';

(2) By Mark Brand (mabrand) on 2024-05-21 08:51:34 in reply to 1.1 [link] [source]

ping

(3) By Stephan Beal (stephan) on 2024-05-22 08:09:06 in reply to 2 [link] [source]

pink:

Just FYI: Richard fixed this yesterday: src:de8182cf1773ac0d0.

(4) By Mark Brand (mabrand) on 2024-05-24 09:00:22 in reply to 3 [link] [source]

Wonderful! Thanks!