-
Notifications
You must be signed in to change notification settings - Fork 49
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
pg_sample doesn't correctly handle generated columns #52
Comments
Looks like we can omit the generated columns by querying the information schema:
I can try and make the change and make a PR if that's useful? I've not written much Perl lately but I think the change would only be a couple of lines around line 696 to extract columns that are not generated:
|
Thank you, @nicholasd-ff ! I will try to review your changes tomorrow. |
This change adds support for sampling tables with generated columns and tests to check the new feature is working correctly. Fixes mla#52
@mla I wrote a test and found a bug, so I made a PR with the proper fix for you. Hope that's OK! |
It currently depends on my earlier PR to update the base image, but if that's a problem I can unstack them for you. |
Hm, and I've encountered another bug with the referential integrity stuff I thought I'd covered that with the test but obviously not. I'll investigate and update the PR because I think my generated table needs a FK constraint to properly check the functionality. |
And the bug is now fixed, and the PR updated. |
If you create a sample database with a single table as follows:
Then dump the table using:
You get a dump file with the generated columns in, which you can't import because the schema prevents it:
Note that this bug doesn't occur with raw pg_dump, which correctly omits the generated column.
The text was updated successfully, but these errors were encountered: