cockroachdb / cockroachdb/cockroach

sql: `setval` cannot be resolved in a UDF body

Open
#110,860 0 comments 0 reactions 0 assignees View on GitHub
A-sql-udf C-bug docs-done docs-known-limitation T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

The `setval` built-in function cannot be resolved when used inside a UDF body.

For example:

```sql
CREATE SEQUENCE s;

SELECT nextval('s');
-- nextval
-- -----------
-- 1

SELECT setval('s', 10, true);
-- setval
-- ----------
-- 10
-- (1 row)

CREATE function my_setval(i INT) RETURNS VOID LANGUAGE SQL AS $$
SELECT setval('s', i, true);
$$;
-- CREATE FUNCTION

SELECT my_setval(100);
-- ERROR: unknown signature: setval(oid)
-- SQLSTATE: 42883
```

Jira issue: CRDB-32711

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.