Re: proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore
Date
Msg-id 20210123065202.GA71334@nol
Whole thread Raw
In response to proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Sat, Jan 23, 2021 at 07:46:01AM +0100, Pavel Stehule wrote:
> Hi
> 
> jsonb with subscripting support can be used as a dictionary object in
> plpgsql.
> 
> Can be nice to have support for iteration over a set of tuples (key,
> value).
> 
> Some like
> 
> FOREACH fieldvar [ KEY keyvar] IN DICTIONARY sourceexpr [VALUE searchexpr]
> LOOP
> END LOOP;
> 
> and for JSON arrays
> 
> FOREACH var IN ARRAY jsonval
> LOOP
> END LOOP
> [...]
> 
> The goal is to support fast iteration over some non atomic objects
> different from arrays.

+1, it seems like something useful to have.



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore
Next
From: Amit Langote
Date:
Subject: Re: simplifying foreign key/RI checks