cockroachdb / cockroachdb/cockroach

plpgsql: implement FOREACH loops

Open
#163,147 0 comments 0 reactions 0 assignees View on GitHub
A-sql-plpgsql A-sql-routine C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

This is a tracking issue for implementing the PL/pgSQL FOREACH statement, Postgres docs [here](https://www.postgresql.org/docs/current/plpgsql-control-structures.html#PLPGSQL-FOREACH-ARRAY). FOREACH is used to iterate through the elements of it array argument. Postgres also supports a SLICE option that allows iterating through slices of a multi-dimensional array. Since we don't yet support multi-dimensional arrays, we can probably ignore SLICE for now. Ex:
```
FOREACH x SLICE 1 IN ARRAY $1 LOOP ... END LOOP;
```

Jira issue: CRDB-60074

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.