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

Fix sequences dependencies tracking. #397

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Conversation

dimitri
Copy link
Owner

@dimitri dimitri commented Jul 20, 2023

A single sequence could be used by more than one table/column thanks to calling the nextval() function in the default value definition of the column. That said, a sequence is OWNED BY a single table.

In this patch we fix the case where the table that owns the sequence is filtered out from the pgcopydb scope while another table that uses the same sequence is to be copied over... with the sequence, then.

A simple way to create the situation is using the following DDL:

create table app.foo(id bigserial, f1 text);
create table copy.foo(like app.foo including all);

And then filter-out schema app from pgcopydb scope.

Fixes #390.

A single sequence could be used by more than one table/column thanks to
calling the nextval() function in the default value definition of the
column. That said, a sequence is OWNED BY a single table.

In this patch we fix the case where the table that owns the sequence is
filtered out from the pgcopydb scope while another table that uses the same
sequence is to be copied over... with the sequence, then.

A simple way to create the situation is using the following DDL:

    create table app.foo(id bigserial, f1 text);
    create table copy.foo(like app.foo including all);

And then filter-out schema app from pgcopydb scope.
@dimitri dimitri merged commit c23eea4 into main Jul 20, 2023
15 checks passed
@dimitri dimitri deleted the fix/sequence-dependencies branch July 20, 2023 10:32
@andyatkinson
Copy link

Is there a way I can run the newer version via Docker? Looks like the current version is v0.12 #352 from June 2023 and there isn't yet a release branch for a new version I'm seeing, although I'm guessing it would be v0.13.

In local development I run Mac OS and in production we run on some Linux container (CentOS I think) so we'd be interested in whatever next version this update lands in for Linux as well.

Thanks!

@dimitri
Copy link
Owner Author

dimitri commented Jul 25, 2023

At the moment we don't have an automated CI recipe to build a docker image at each commit in the main branch, so instead you can build a docker image from the current source by doing make build. It expands to the following:

$ make version
$ docker build -t pgcopydb .

So you could also use that to label the image with your own tags etc if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sequence in public schema cannot be restored creating table in non-public schema
2 participants