cockroachdb / cockroachdb/cockroach
plpgsql: variables in the INTO clause "absorb" comments
Open
A-sql-plpgsql
A-sql-routine
C-bug
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When an inline comment follows the target variable(s) of a PL/pgSQL INTO clause, the comment text is incorrectly added to the variable string as if it had been surrounded by quotes. Here's an example:
```
root@localhost:26257/defaultdb> DO $$
-> DECLARE foo INT;
-> BEGIN SELECT 1 INTO foo -- INLINE COMMENT
-> ;
-> END
-> $$;
ERROR: "foo -- INLINE COMMENT" is not a known variable
SQLSTATE: 42601
```
Related to #126727.
Jira issue: CRDB-57776
Contributor guide
Assessment
This issue has not been assessed yet.