graphql-engine
graphql-engine copied to clipboard
server/refactor: use `Set`/`HashSet` to deduplicate function names in `runTxWithMetadataCheck`
The root cause of graphql-engine#8643: Migrations fail if duplicate functions exist is that the list of functions to consider for metadata diff checks ends up with duplicates when a function is tracked both as root field and as computed field:
https://github.com/hasura/graphql-engine/blob/f80ec1d543e0e3e4711fe72bb8f19c097e6897c1/server/src-lib/Hasura/Backends/Postgres/DDL/RunSQL.hs#L303
The proper fix is to ensure that we use sets/hashsets in all the functions involved instead of lists in order to statically ensure no duplicates appear by accident.
Hi, can I have a go at this issue? Thank you
Hey, @Declan-Y thank you for your interest! Feel free to work on this and open a PR.
Doesn't the nub
function remove duplicates?
Sorry never mind, I just noticed that in b0d2262, nub
was added as a quick workaround, but is an inefficient way to remove duplicates