SQLite Forum

Inconsistent docs for the returned type of the ->> operator
Login

Inconsistent docs for the returned type of the ->> operator

(1.1) By PChemGuy on 2024-06-02 06:54:10 edited from 1.0 [source]

The section "JSON Functions And Operators - 4.9" states that "The ->> operator returns an SQL TEXT, INTEGER, REAL, or NULL value". At the same time, the section "SQL Language Expressions - 2" states that "the -> and ->> extract operators which evaluate to either NULL or a text value".

(2.3) By Adrian Ho (lexfiend) on 2024-06-03 16:20:09 edited from 2.2 in reply to 1.1 [link] [source]

the section "SQL Language Expressions - 2" states that "the -> and ->> extract operators which evaluate to either NULL or a text value".

Where did you read this? I see instead:

The result of any binary operator is either a numeric value or NULL, except for the || concatenation operator, and the -> and ->> extract operators which can return values of any type.

(Though if I wanted to nitpick, -> can only return a TEXT value or NULL, as stated in the first link you posted.)

(3.2) By PChemGuy on 2024-06-04 05:28:32 edited from 3.1 in reply to 2.3 [link] [source]

Well, apparently one of the devs has fixed the docs after my post.

As you stated, this edit ia still not consistent with the JSON library docs stating that ->> may return any [SQLite] type, but not ->, which "returns a text JSON representation of the selected subcomponent or NULL if that subcomponent does not exist". And I would disagree about nitpicking: AFAICT, this is THE difference that sets the two operators apart, and the reason why there are two operators, not one.