cockroachdb / cockroachdb/cockroach
plpgsql: add support for complex variable references
Open
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
Postgres allows variable references to be qualified, for example, by block label. This can be used to specify which variable applies in case of variable shadowing (support for which is tracked in #117508). Ex:
```
postgres=# CREATE PROCEDURE p() LANGUAGE PLpgSQL AS $$ <> DECLARE x INT := 100; BEGIN DECLARE x INT := 200; BEGIN RAISE NOTICE '% %', foo.x, x; END; END; $$;
CREATE PROCEDURE
postgres=# CALL p();
NOTICE: 00000: 100 200
LOCATION: exec_stmt_raise, pl_exec.c:3883
CALL
```
Jira issue: CRDB-36886
Contributor guide
Assessment
This issue has not been assessed yet.