Re: BUG #18222: Unexpected Error--Cannot delete from scalar

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: bajinsheng(at)u(dot)nus(dot)edu, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18222: Unexpected Error--Cannot delete from scalar
Date: 2023-12-04 13:50:16
Message-ID: e4e500f6f4f423de9df3e99680cd551c6253ae0c.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-12-04 14:07:29 Re: BUG #18224: message bug in libpqwalreceiver.c.
Previous Message PG Bug reporting form 2023-12-04 13:47:24 BUG #18225: chdb's s3 table function crashes postgresql with plpython3