cockroachdb / cockroachdb/cockroach
Support IDENTITY column creation using existing sequence
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In postgres, you can name the sequence which will be created or use an existing schema when using `IDENTITY` syntax with the `SEQUENCE NAME` sequence option. Cockroach does not currently support this option.
For example:
```
CREATE SEQUENCE foo;
CREATE TABLE t (i INT GENERATED BY DEFAULT AS IDENTITY (SEQUENCE NAME foo));
```
It would be great to support this syntax in CockroachDB
#### Additional Context
You can get the same behavior in cockroach and postgres with this syntax:
```
CREATE TABLE t (i INT DEFAULT (nextval('foo')));
```
What cockroach doesn't support is controlling the name of a newly generated sequence.
Jira issue: CRDB-24921
Contributor guide
Assessment
This issue has not been assessed yet.