Re: [HACKERS] [PATCH] Generic type subscripting

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, David Steele <david(at)pgmasters(dot)net>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Oleksandr Shulgin <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
Date: 2021-01-07 08:16:32
Message-ID: 20210107081632.ln754faazmeefshg@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On Wed, Jan 06, 2021 at 09:22:53PM +0100, Pavel Stehule wrote:
> this case should to raise exception - the value should be changed or error
> should be raised
> postgres=# insert into foo values('{}');
> postgres=# update foo set a['a'] = '100';
> postgres=# update foo set a['a'][1] = '-1';
> postgres=# select * from foo;
> ┌────────────┐
> │ a │
> ╞════════════╡
> │ {"a": 100} │
> └────────────┘

I was expecting this question, as I've left this like that intentionally
because of two reasons:

* Opposite to other changes, to implement this one we need to introduce
a condition more interfering with normal processing, which raises
performance issues for already existing functionality in jsonb_set.

* I vaguely recall there was a similar discussion about jsonb_set with
the similar solution.

For the references what I mean I've attached the third patch, which does
this. My opinion would be to not consider it, but I'm fine leaving this
decision to committer.

Attachment Content-Type Size
v44-0001-Subscripting-for-jsonb.patch text/x-diff 45.6 KB
v44-0002-Filling-gaps-in-jsonb.patch text/x-diff 21.4 KB
v44-0003-Replace-assuming-a-composite-object-on-a-scalar.patch text/x-diff 3.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message easteregg 2021-01-07 08:19:06 Re: plpgsql variable assignment with union is broken
Previous Message Peter Smith 2021-01-07 08:11:45 Re: Single transaction in the tablesync worker?