proposal - enhancing plpgsql's FOREACH statement for support json type - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal - enhancing plpgsql's FOREACH statement for support json type
Date
Msg-id CAFj8pRAihABRPfb+L6dYtECQ9Z1xpz0g_U+Y_BbEnf78M5qeyA@mail.gmail.com
Whole thread Raw
List 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

pgsql-hackers by date:

Previous
From: "王伟(学弈)"
Date:
Subject: 回复:Re: PANIC: wrong buffer passed to visibilitymap_clear
Next
From: Alvaro Herrera
Date:
Subject: Re: Make name optional in CREATE STATISTICS