Re: [PATCH] Generic type subscription

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Artur Zakirov <a.zakirov@postgrespro.ru>, Aleksander Alekseev <a.alekseev@postgrespro.ru>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Victor Wagner <vitus@wagner.pp.ru>, Haribabu Kommi <kommi.haribabu@gmail.com>
Date: 2017-01-26T18:21:44Z
Lists: pgsql-hackers
On Mon, Jan 23, 2017 at 2:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Can we arrange to do that differently?  I'd prefer something in which the
> argument and result types are visibly connected to the actual datatypes
> at hand, for instance
>           array_subscript(anyarray, internal) returns anyelement
>           array_assign(anyarray, internal, anyelement) returns anyarray

What about having no internal arguments here at all?  Like if you want
to support foo[4] define a subscript function that takes (mytype, int)
and returns whatever.  You might have to allow for multiple
subscripting functions with different argument types for this to
really work, though.

/me ducks

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Commits

  1. Throw error when assigning jsonb scalar instead of a composite object

  2. Filling array gaps during jsonb subscripting

  3. Implementation of subscripting for jsonb

  4. Support subscripting of arbitrary types, not only arrays.

  5. Remove obsoleted code relating to targetlist SRF evaluation.

  6. Include <sys/select.h> where needed