Re: proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore
Date: 2021-01-23 06:52:02
Message-ID: 20210123065202.GA71334@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-01-23 07:10:24 Re: simplifying foreign key/RI checks
Previous Message Pavel Stehule 2021-01-23 06:46:01 proposal - idea - enhancing plpgsql FOREACH for JSON, jsonb and hstore