Re: MAP syntax for arrays - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: MAP syntax for arrays
Date
Msg-id 20180508141806.io5jtovdjqxydbrv@alvherre.pgsql
Whole thread Raw
In response to Re: MAP syntax for arrays  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: MAP syntax for arrays  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut wrote:
> On 5/8/18 09:19, Chapman Flack wrote:
> > On 05/08/2018 08:57 AM, Ildar Musin wrote:
> >>
> >> select map (pow(2, x) - 1 for x in array[1,2,3,4,5]);
> > 
> > I wonder how efficient an implementation would be possible strictly
> > as a function, without grammar changes?
> 
> Yeah, you can pass a function to another function (using regprocedure or
> just oid), so this should be possible entirely in user space.

How would you invoke it?  It seems you'd be forced to use EXECUTE in a
plpgsql function, or a C function.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: MAP syntax for arrays
Next
From: Юрий Соколов
Date:
Subject: Re: [HACKERS] Clock with Adaptive Replacement