cockroachdb / cockroachdb/cockroach

plpgsql: improve error message for misplaced block label

Open
#122,298 0 comments 0 reactions 0 assignees View on GitHub
A-sql-plpgsql A-sql-routine C-cleanup O-qa T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

```sql
DROP PROCEDURE IF EXISTS p;
CREATE PROCEDURE p() LANGUAGE PLpgSQL AS $$
DECLARE
x INT = 0;
<>
BEGIN
x = x + 1;
RAISE NOTICE 'x=%', x;
END outer;
$$;
```
results in a better error message in postgres:
```
-- postgres: ERROR: 42601: block label must be placed before DECLARE, not after
-- crdb: ERROR: 42601: at or near "<": syntax error
```

Jira issue: CRDB-37792

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.