Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: nextval() returns sequence not exists error for column created with GENERATED BY DEFAULT AS IDENTITY #107234

Closed
giangpham712 opened this issue Jul 20, 2023 · 1 comment · Fixed by #107358
Assignees
Labels
A-tools-efcore C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner

Comments

@giangpham712
Copy link

giangpham712 commented Jul 20, 2023

Describe the problem

Calling pg_get_serial_sequence for a database column created with GENERATED BY DEFAULT AS IDENTITY returns a sequence name but calling nextval for the returned sequence returns error.

To Reproduce

Create a table using the following

CREATE TABLE public."Animal" (
  "Id" INT8 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  CONSTRAINT "PK_Animal" PRIMARY KEY ("Id" ASC)
)

Running

SELECT pg_get_serial_sequence('"Animal"', 'Id');

returns

pg_get_serial_sequence
--------------------------
  public.Animal_Id_seq
(1 row)

but

running

SELECT nextval('public.Animal_Id_seq');

returns

ERROR: nextval(): relation "public.animal_id_seq" does not exist
SQLSTATE: 42P01

Add any other context about the problem here.
This error is affecting a number of tests in efcore.pg library when running against CockroachDB

Jira issue: CRDB-29954

@giangpham712 giangpham712 added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Jul 20, 2023
@blathers-crl
Copy link

blathers-crl bot commented Jul 20, 2023

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

  • @cockroachdb/sql-foundations (found keywords: pg_)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Jul 20, 2023
@rafiss rafiss added A-tools-efcore T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Jul 21, 2023
@rafiss rafiss self-assigned this Jul 21, 2023
@craig craig bot closed this as completed in #107358 Jul 21, 2023
@craig craig bot closed this as completed in 832e5f2 Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tools-efcore C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants