proposal - enhancing plpgsql's FOREACH statement for support json type

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: proposal - enhancing plpgsql's FOREACH statement for support json type
Date: 2022-07-22 13:04:11
Message-ID: CAFj8pRAihABRPfb+L6dYtECQ9Z1xpz0g_U+Y_BbEnf78M5qeyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

now we have lot of nice json related functions and I think so can be nice
if plpgsql's statement FOREACH can directly support json type. It can save
some CPY cycles by reducing some transformations.

My idea is following -

new syntax

FOREACH targetvar IN JSON ARRAY json array expr
LOOP
...

and

FOREACH targetvar, keyvar IN JSON OBJECT json record expr
LOOP
...

What do you think about this proposal? Comments, notes?

Regards

Pavel

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-07-22 13:06:46 Re: Make name optional in CREATE STATISTICS
Previous Message 王伟 (学弈) 2022-07-22 12:17:51 回复:Re: PANIC: wrong buffer passed to visibilitymap_clear