pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mark.drake@golden-hind.com
Subject: BUG #18809: Inconsistent JSON behavoir
Date: Thu, 13 Feb 2025 03:22:20 +0000
Message-ID: <18809-601694c9be8a4026@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18809
Logged by:          Mark Drake
Email address:      mark.drake@golden-hind.com
PostgreSQL version: 17.0
Operating system:   Linux
Description:        

broadway=# select jsonb('[2,3,1]') @> to_jsonb(1);
 ?column?
----------
 t
(1 row)


broadway=# select jsonb('[2,3,1]') @> to_jsonb(4);
 ?column?
----------
 f
(1 row)


broadway=# select jsonb('[2,3,1]') @> to_jsonb(4);
 ?column?
----------
 f
(1 row)


broadway=# select jsonb('[2,3,1]') - 1;
 ?column?
----------
 [2, 1]
(1 row)


broadway=#
broadway=# select jsonb('[2,3,1]') - to_jsonb(1);
ERROR:  operator does not exist: jsonb - jsonb
LINE 1: select jsonb('[2,3,1]') - to_jsonb(1);
                                ^
HINT:  No operator matches the given name and argument types. You might need
to add explicit type casts.
broadway=#

Given that the first statement show the array contains an element that
matches to_jsonb(1) the fourth statement should delete the third ( index 2)
item from the array, not return an argument type mismatch. This would solve
the problem of not being able to delete from a JSON integer array by value



view thread (3+ messages)  latest in thread

Message-ID: <18809-601694c9be8a4026@postgresql.org>
Permalink:  ../18809-601694c9be8a4026@postgresql.org/
Also on:    postgresql.org/message-id/18809-601694c9be8a4026@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, mark.drake@golden-hind.com
  Subject: Re: BUG #18809: Inconsistent JSON behavoir
  In-Reply-To: <18809-601694c9be8a4026@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox