Re: A Generic Question about Generic type subscripting - Mailing list pgsql-hackers

From Arthur Zakirov
Subject Re: A Generic Question about Generic type subscripting
Date
Msg-id 20180129124740.GA7088@zakirov.localdomain
Whole thread Raw
In response to A Generic Question about Generic type subscripting  (Hannu Krosing <hannu.krosing@2ndquadrant.com>)
List 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


pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: JIT compiling with LLVM v9.0
Next
From: Michael Paquier
Date:
Subject: Re: PATCH: Exclude unlogged tables from base backups