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

Allow identity based sequences to be found and reset #778

Merged
merged 4 commits into from
May 15, 2024

Conversation

kbarber
Copy link
Contributor

@kbarber kbarber commented May 14, 2024

Fixes: #777

I put this up as a fix and a regression test for #777. With some changes to the query I've managed to get it discovering identity + normal sequences:

create sequence kbgood_id_seq;
create table kbgood (id integer primary key default nextval('kbgood_id_seq'));

create table kbbad (id integer generated always as identity);
-- implies kbbad_id_seq is created
12:46:12.370 624 INFO   sequences.c:78            Fetching information for 2 sequences
12:49:30.865 650 SQL    pgsql.c:1572              [TARGET 308053] 'public.kbbad_id_seq', '1', 'false'
12:49:32.412 650 SQL    pgsql.c:1559              [TARGET 308053] select pg_catalog.setval($1::regclass, $2, $3);
12:49:32.412 650 SQL    pgsql.c:1572              [TARGET 308053] 'public.kbgood_id_seq', '1', 'false'
12:49:32.926 650 SQL    pgsql.c:1559              [TARGET 308053] select pg_catalog.setval($1::regclass, $2, $3);

@kbarber kbarber force-pushed the allow-identity-sequences branch 3 times, most recently from 6a16e29 to 2a3be45 Compare May 15, 2024 15:59
@kbarber kbarber marked this pull request as ready for review May 15, 2024 16:27
Copy link
Owner

@dimitri dimitri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm not sure how to reason about the SQL changes by themselves, so I must admit I'm relying on the test suite here. Speaking of which, see comments.

tests/pagila/copydb.sh Outdated Show resolved Hide resolved
tests/pagila/copydb.sh Outdated Show resolved Hide resolved
@dimitri dimitri added bug Something isn't working good first issue Good for newcomers labels May 15, 2024
@dimitri dimitri added this to the v0.16 milestone May 15, 2024
@kbarber
Copy link
Contributor Author

kbarber commented May 15, 2024

@dimitri passing again

@dimitri dimitri merged commit 22b3fac into dimitri:main May 15, 2024
18 checks passed
@dimitri
Copy link
Owner

dimitri commented May 15, 2024

Thanks @kbarber !

@kbarber kbarber deleted the allow-identity-sequences branch May 15, 2024 18:38
@kbarber
Copy link
Contributor Author

kbarber commented May 15, 2024

I'm not sure how to reason about the SQL changes by themselves, so I must admit I'm relying on the test suite here.

@dimitri goes without saying I guess, but if you get a regression and need me let me know. Thanks for your help on this one, I prefer the unit test area, I'll be sure to populate it some more :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pgcopydb fails to find identity sequences
2 participants