cockroachdb / cockroachdb/cockroach
sql: consider retaining comments in routine body
Open
A-sql-routine
C-cleanup
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Currently, we discard all SQL comments from the routine body:
```sql
CREATE PROCEDURE p(OUT INT) LANGUAGE SQL AS $$
-- inline comment
SELECT 1;
$$;
SELECT create_statement FROM [SHOW CREATE PROCEDURE p];
```
```
CREATE PROCEDURE public.p(OUT INT8)
LANGUAGE SQL
SECURITY INVOKER
AS $$
SELECT 1;
$$
```
We should consider retaining the comments in some way (e.g. storing the original SQL string in a separate field somewhere), ideally inlined in the body.
There is some discussion [here](https://cockroachlabs.slack.com/archives/G01R3EYPQKA/p1732563045609389).
Jira issue: CRDB-44900
Contributor guide
Assessment
This issue has not been assessed yet.