pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Dolgov <9erthalion6@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: David Steele <david@pgmasters.net>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: David Fetter <david@fetter.org>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Oleg Bartunov <obartunov@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
Date: Fri, 18 Dec 2020 20:59:25 +0100
Message-ID: <20201218195925.4qj6p2kxrvkdrmur@localhost> (raw)
In-Reply-To: <112397.1608236975@sss.pgh.pa.us>
References: <20201209183704.x5ue5rctdwmhmlmy@localhost>
	<3674425.1607540422@sss.pgh.pa.us>
	<3724341.1607551174@sss.pgh.pa.us>
	<CAFj8pRCbH_48FfTGHczts8hTA4e0eKhcs5UwdybotoQEH_Pfcg@mail.gmail.com>
	<20201211151957.wqlnxdqjwsd7azzd@localhost>
	<4110100.1607701087@sss.pgh.pa.us>
	<20201217182003.nrhxqqiutfwjesen@localhost>
	<107232.1608230957@sss.pgh.pa.us>
	<20201217200033.qdyjv4iimwyglnwt@localhost>
	<112397.1608236975@sss.pgh.pa.us>

> On Thu, Dec 17, 2020 at 03:29:35PM -0500, Tom Lane wrote:
> Dmitry Dolgov <9erthalion6@gmail.com> writes:
> > On Thu, Dec 17, 2020 at 01:49:17PM -0500, Tom Lane wrote:
> >> We can certainly reconsider the API for the parsing hook if there's
> >> really a good reason for these to be different types, but it seems
> >> like that would just be encouraging poor design.
>
> > To be more specific, this is the current behaviour (an example from the
> > tests) and it doesn't seem right:
>
> >     =# update test_jsonb_subscript
> >        set test_json['a'] = 3 where id = 1;
> >     UPDATE 1
> >     =# select jsonb_typeof(test_json->'a')
> >        from test_jsonb_subscript where id = 1;
> >      jsonb_typeof
> >      --------------
> >       string
>
>
> I'm rather inclined to think that the result of subscripting a
> jsonb (and therefore also the required source type for assignment)
> should be jsonb, not just text.  In that case, something like
> 	update ... set jsoncol['a'] = 3
> would fail, because there's no cast from integer to jsonb.  You'd
> have to write one of
> 	update ... set jsoncol['a'] = '3'
> 	update ... set jsoncol['a'] = '"3"'
> to clarify how you wanted the input to be interpreted.
> But that seems like a good thing, just as it is for jsonb_in.

Yep, that makes sense, will go with this idea.





view thread (276+ messages)  latest in thread

Message-ID: <20201218195925.4qj6p2kxrvkdrmur@localhost>
Permalink:  ../20201218195925.4qj6p2kxrvkdrmur@localhost/
Also on:    postgresql.org/message-id/20201218195925.4qj6p2kxrvkdrmur@localhost

 · 

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-hackers@postgresql.org
  Cc: 9erthalion6@gmail.com, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, andres@anarazel.de, aekorotkov@gmail.com, pryzby@telsasoft.com, david@pgmasters.net, n.gluhov@postgrespro.ru, alvherre@2ndquadrant.com, david@fetter.org, thomas.munro@gmail.com, oleksandr.shulgin@zalando.de, robertmhaas@gmail.com, michael.paquier@gmail.com, obartunov@gmail.com, peter.eisentraut@2ndquadrant.com
  Subject: Re: [HACKERS] [PATCH] Generic type subscripting
  In-Reply-To: <20201218195925.4qj6p2kxrvkdrmur@localhost>

* 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