-
Notifications
You must be signed in to change notification settings - Fork 61
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
Generated columns order differs from reference DB's table (1.0 beta 1 for linux) #37
Comments
to solve this issue I had to to replace the following line in column.go
this would add up the cardinal position of the column in the sort criteria compare_name leading to correct order |
joncrlsn#37 to solve this issue I had to to replace the following line in column.go , {{if eq $.DbSchema "*" }}table_schema || '.' || {{end}}table_name || '.' || column_name AS compare_name by , {{if eq $.DbSchema "*" }}table_schema || '.' || {{end}}table_name || '.' ||lpad(cast (ordinal_position as varchar), 5, '0')|| column_name AS compare_name this would add up the cardinal position of the column in the sort criteria compare_name leading to correct order
Can you create a pull request for that change? |
|
Thank you! |
Interestingly, I have two tables whose order in an existing database has diverted over time (due to column additions) from the order in the template schema for new deployments. The most recent commit of pgdiff creates an enormous amount of CREATE/DROP COLUMN statements when diffing those two for the purpose of adjusting to the column order, so I bisected it and identified this pull request as the cause, which sorta makes sense. Reverting it makes it work as before. Could we have this configurable? Since existing the database is quite large, I do not want to actually re-order those columns for the sole purpose of matching the template schema, and I'd still like those two schemas to be considered as equal. Otherwise, I'll just carry a little patch on our local fork, that'd be okay to. |
yeah I seem to be having the same problem. I don't care about column order, just that they exist or don't exist. EDIT: yup, much happier now, creates diffs regardless of column order and it doesn't yield incorrect column drops after adds. |
I have 2 DB, reference DB have 10 tables, target one have 9.
Original columns order of books_lost table:
Order, formed by Pgdiff (sortted by alphabet)
6-COLUMN.sql
The difference affects error on futher data synchronization between DB's. It would be right to leave original columns order.
The text was updated successfully, but these errors were encountered: