cockroachdb / cockroachdb/cockroach

sql: creating a udf with a builtin keyword name should fail

Open
#111,386 0 comments 0 reactions 0 assignees View on GitHub
C-bug T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Some keyword functions like `substring` and `trim` are not allowed as UDFs in postgres, e.g.,:

```
marcus=# CREATE FUNCTION substring() RETURNS VOID LANGUAGE SQL AS '';
ERROR: 42601: syntax error at or near "("
LINE 1: CREATE FUNCTION substring() RETURNS VOID LANGUAGE SQL AS '';
^
LOCATION: scanner_yyerror, scan.l:1180
```

We currently allow these functions to be created in CRDB, though they can never be executed. We should return a syntax error for compatibility.

Jira issue: CRDB-31880

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.