-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add support for identity columns #163
Comments
Generated isn't supported yet but serials and sequences are. I recommend using one of those instead. |
serials are not recommended by Postgres itself https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_serial. postgres recommends using Identity for new ones. so i am not sure everyone else will be happy using others. |
Many of the reasons listed there are schema management, which this tool papers over for you. |
So you recommend using serial over generated identity? |
No, I'm just saying more to unblock yourself, it might make sense to use serials instead of generated values until support is added. |
We will be rolling this app soon so we might start writing data soon as well so changing types again will be a problem |
A serial column is probably naively coercible to a generated value (worth checking). You would want to start the new generated column at an offset higher than the current value (with a significant buffer to account for a race). Alternatively, you could try to wait for me to implement this. Unfortunately, I have pretty limited time and implementing new features is not a top priority. |
Can you throw some insights for me so I can give it a shot if you are open to accept pull requests ? |
I can probably knock this out today. Let me try to throw a PR up! (for identity columns). |
PR is ready to go! Probably will get a review on Monday and in some time that day. In in the interim, you can try it out. |
@Navbryce for some reason the identity columns are missing nextval() from information schema rather they take a random id for insert, any insights on this ? |
I mean is the column created correctly by pg-schema-diff, or does this appear to be a Postgres issue? |
Probably looks like the bulk inserts are causing issue with seq falling behind |
Sorry my bad it was the bulk copy which was causing the issue. |
No worries! If the generated SQL is correct (schema), then the problem is within the application or Postgres. pg-schema-diff doesn't (directly) affect the actual "data plane" of postgres. |
creates
where as it should create
The text was updated successfully, but these errors were encountered: