On Mon, 2023-12-04 at 05:56 +0000, PG Bug reporting form wrote:
> PostgreSQL version: 16.1
>
> SELECT ('1'-to_hex(2))::BOOLEAN; -- ERROR: cannot delete from scalar
>
> This error looks strange to me as I do not understand what this error
> means.
>
> If I execute the following query, there is no error instead:
> SELECT '1'-2; -- {-2}
That's not a bug.
PostgreSQL infers the operator jsonb - text. '1' gives a valid "jsonb"
scalar, but you cannot remove an attribute from a JSON scalar.
I cannot tell you what to do, because your expression makes as little
sense to me as it does to PostgreSQL.
Yours,
Laurenz Albe