pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Jelinek <petr@2ndquadrant.com>
To: Andrew Dunstan <andrew@dunslane.net>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-committers@postgresql.org <pgsql-committers@postgresql.org>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Subject: Re: pgsql: Additional functions and operators for jsonb
Date: Wed, 13 May 2015 18:28:57 +0200
Message-ID: <55537BC9.1080805@2ndquadrant.com> (raw)
In-Reply-To: <555360E0.2040004@dunslane.net>
References: <E1YsGHP-0006De-1z@gemulon.postgresql.org>
	<CAFj8pRDX5KTc8C8yENzF1Z8APS=3sM3Z4T0gV1o+C8cbbxu3qw@mail.gmail.com>
	<555360E0.2040004@dunslane.net>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

On 13/05/15 16:34, Andrew Dunstan wrote:
>
> On 05/12/2015 04:11 PM, Pavel Stehule wrote:
>> Hi
>>
>> I did some tests, and I am not sure if this is not bug:
>>
>> postgres=# select '{"x":20}'::jsonb - 'x'::text;
>> ERROR:  unknown type of jsonb container --->>> it should be empty
>> jsonb, not error
>> Time: 0.971 ms
>> postgres=# select '{"x":20, "y":30}'::jsonb - 'x'::text;
>> ┌───────────┐
>> │ ?column?  │
>> ╞═══════════╡
>> │ {"y": 30} │
>> └───────────┘
>> (1 row)
>>
>>
>>
>
>
>
> Some of this logic needs tightening. The attached patch should do that.
> Among other things, it errors out if we attempt to delete or replace on
> a scalar, just returns the input argument if there are no changes
> instead of cloning it, checks via an Assert that the constructed
> JsonbValue is not null, and otherwise returns it unconditionally. The
> result is actually simpler code, I think. Before I apply it I'd like to
> have comments from Dmitry and Petr, just to make sure I haven't
> inadvertently slipped my moorings.
>

I think it's ok like this, except that the "cannot get delete from 
scalar" error message should probably be "cannot delete from scalar" in 
both places.


-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (10+ messages)  latest in thread

Message-ID: <55537BC9.1080805@2ndquadrant.com>
Permalink:  ../55537BC9.1080805@2ndquadrant.com/
Also on:    postgresql.org/message-id/55537BC9.1080805@2ndquadrant.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: petr@2ndquadrant.com, andrew@dunslane.net, pavel.stehule@gmail.com, 9erthalion6@gmail.com
  Subject: Re: pgsql: Additional functions and operators for jsonb
  In-Reply-To: <55537BC9.1080805@2ndquadrant.com>
  References: <E1YsGHP-0006De-1z@gemulon.postgresql.org> <CAFj8pRDX5KTc8C8yENzF1Z8APS=3sM3Z4T0gV1o+C8cbbxu3qw@mail.gmail.com> <555360E0.2040004@dunslane.net> <55537BC9.1080805@2ndquadrant.com>

* 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