Replies: 1 comment
-
Hello! It seems you are right, we should remove sorting (and indicate this requirement for the argument somehow) or sort |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here the get_columns() call uses the TABLE_COLUMN_QUERY with "ORDER BY cc.ordinal_position ASC":
https://github.com/datanymizer/datanymizer/blob/main/datanymizer_dumper/src/postgres/schema_inspector.rs#L147
When
set_columns()
is called, the code below runs. Thecolumns
arg is in position order already. This code then createscolumn_refs
, sorts it by the.position
value, and creates a map from string name to the index of column_refs. Then it saves the columns vec and the map, but lets column_refs go out of scope.datanymizer/datanymizer_dumper/src/postgres/table.rs
Lines 94 to 104 in 2dc82b3
I don't see the point of column_refs since it's the same order as columns is to start, and if it was different somehow, the map would be invalid because it doesn't point to column indexes. Fix appears to be removing
column_refs
altogether, and create the map usingcolumn
indexes.Am I misunderstanding this?
Beta Was this translation helpful? Give feedback.
All reactions