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