graphile / graphile-engine

Monorepo home of graphile-build, graphile-build-pg, graphile-utils, postgraphile-core and graphql-parse-resolve-info. Build a high-performance easily-extensible GraphQL schema by combining plugins!
https://www.graphile.org/
761 stars 129 forks source link

Multiple services resulting in duplicate codecs for simple types #850

Closed codelizrd closed 11 months ago

codelizrd commented 11 months ago

Hi! I started using V5 in a new project and I noticed the ability to add multiple pgServices's.

Both databases get inspected, but it then terminates as both DB 'A' and 'B' have a varchar[] type in a table column, which it tries to map.

The error thrown all the way up: Attempted to add a second codec named 'varchar[]'

When inspecting the code in @dataplan I commented out the Exception, and then a nicer more explanatory exception was thrown by graphile-build-pg: Error: Two different codecs were created with the same name 'varchar[]'; please ensure all codec names are unique. If you are creating codecs from multiple services, consider prefixing the codec names with the service's name.

By also commenting out this exception my setup with 5 database connections is working like a charm. I tried to find the right inflection method to prefix the codec name with the name of the schema, but had no success as it seems inflection is only used for complex types?

benjie commented 11 months ago

This repository only relates to PostGraphile V4; closing as duplicate of https://github.com/graphile/crystal/issues/1871