Postgraphile: Blacklist/wishlist

Created on 27 Mar 2017  ·  8Comments  ·  Source: graphile/postgraphile

I know, you should care about permissions in postgres directly. But introducing blacklists can prevent some issues with conflicts. It should be good to report this in log as notice level in development but definitely this can workaround some human talks.

It can open next level-mapping of generated name to customized one. This can be used as transition thing too.

✨ Possible via v4 plugin ✨ feature

All 8 comments

Hi @langpavel, what is it you wish to blacklist - is it the role?

Hi @benjie
I want blacklist (or whitelist) every object which can be reflected by postgraphql.
There are some hardly resolvable issues with name clashing which can be resolved only by changing database.
For example, if you try fresh (empty) PostGIS database, reflection will fail..

I'd recommend using schemas to avoid that issue, however you could do it by hacking the introspection query:

https://github.com/postgraphql/postgraphql/blob/1145689054f7f7a6a5542ec34aa3827af3bc572a/resources/introspection-query.sql

Alternatively you could doctor the PgCatalog and feed it back in, based on the work in this PR:

https://github.com/postgraphql/postgraphql/pull/306

I didn’t think about manually mutating PgCatalog, or creating your own with a custom introspection query. That’s an interesting and powerful idea.

@langpavel if you try that please let us know how it turns out 👍

Actually I tried something similar some weeks ago but it is easier to filter out introspection query because of too tight internal logic.

Does modifying the introspection query and/or its results work for you?

In PostGraphQL v4 you'll be able to replace the introspection plugin with your own:

https://github.com/postgraphql/graphql-build/blob/master/packages/graphql-build-pg/src/plugins/PgIntrospectionPlugin.js

You can now use the @omit smart comment to blacklist tables / columns / functions / etc: https://www.graphile.org/postgraphile/smart-comments/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angelosarto picture angelosarto  ·  3Comments

ssomnoremac picture ssomnoremac  ·  5Comments

jayp picture jayp  ·  3Comments

jwdotjs picture jwdotjs  ·  5Comments

calebmer picture calebmer  ·  3Comments