Re: A Generic Question about Generic type subscripting

From: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
To: Hannu Krosing <hannu(dot)krosing(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: A Generic Question about Generic type subscripting
Date: 2018-01-29 12:47:41
Message-ID: 20180129124740.GA7088@zakirov.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 29, 2018 at 09:45:15AM +0200, Hannu Krosing wrote:
> ...
> I see two possibilities
>
> 1) add a third "ARG" to the CREATE OPERATOR syntax, maybe VALUEARG
> 2) use composite types - so for
>
> jsonb1[int1] = jsonb2
>
> the operator would be defined by first defining a
>
> CREATE TYPE intkey_and_jsonvalue as (key int, value jsonb)
> and then using this in
> CREATE OPERATOR [...] (PROCEDURE = jsonb_set_key, LEFTARG=jsonb,
> RIGHTARG=intkey_and_jsonvalue)

I think it will work for assignments. But what about fetching. For
example we have:

CREATE TYPE intkey_and_jsonvalue as (key int, value jsonb);
CREATE TYPE intkey_and_textvalue as (key int, value text);

What should return the next query?

select jsonb1[int1];

--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-01-29 12:54:48 Re: PATCH: Exclude unlogged tables from base backups
Previous Message Konstantin Knizhnik 2018-01-29 12:45:56 Re: JIT compiling with LLVM v9.0