cockroachdb / cockroachdb/cockroach

plpgsql: implement variable shadowing

Open
#117,508 0 comments 1 reaction 0 assignees View on GitHub
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

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.