cockroachdb / cockroachdb/cockroach
plpgsql: implement variable shadowing
Open
A-sql-plpgsql
C-enhancement
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In postgres, it is possible to shadow variables or parameters by declaring a variable with the same name in an inner block. This issue tracks adding support for variable shadowing. Ex:
```
CREATE PROCEDURE p_shadow(x INT) LANGUAGE PLPGSQL AS $$
DECLARE
x INT := 5;
BEGIN
RAISE NOTICE '%', x;
END
$$;
CALL p_shadow(100); -- Should print 5 instead of 100.
```
Jira issue: CRDB-35222
Contributor guide
Assessment
This issue has not been assessed yet.