cockroachdb / cockroachdb/cockroach
plpgsql: reuse the sql scan logic
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
Right now, the [PL/pgSQL scanner](https://github.com/cockroachdb/cockroach/blob/752b00dac3ba9bc406a76ca521841937a3df329b/pkg/sql/scanner/plpgsql_scan.go#L27-L29) duplicates much of the logic in the SQL scanner. This is mostly because PL/pgSQL has its own set of tokens, the IDs of which differ from the SQL tokens due to the order in which they're defined in the `plpgsql.y` file. Postgres shares this logic, and is able to do so because it carefully keeps the token IDs in line. We should consider making a similar change.
Jira issue: CRDB-36297
Contributor guide
Assessment
This issue has not been assessed yet.