Questions tagged [postgraphile]

A GraphQL API created by reflection over a PostgreSQL schema. Formerly PostGraphQL.

https://github.com/graphile/postgraphile

118 questions
3
votes
0 answers

React-admin, how to properly handle auth error on dataProvider?

I am trying to integrate an authenticated data provider into React-Admin but I am having trouble when the data provider does not yet have a valid auth token from the auth provider. I am using https://github.com/des-des/ra-postgraphile-client My code…
reaaaaact
  • 31
  • 1
3
votes
2 answers

"[GraphQL error]: Message: permission denied for function" using JWT in headers

The problem Queries not requiring authorisation succeed, but a query requiring JWT authorisation fails. Errors In the browser console, I get the following error message: [GraphQL error]: Message: permission denied for function get_account_info,…
Stas
  • 305
  • 3
  • 8
2
votes
1 answer

ERROR: invalid input syntax for type uuid on wrong column - Postgresql 14.2

I am in progress of writing a function that takes 2 objects. My goal is to have the restaurant be optionally inserted if it does not exist followed by inserting the food item into its respective tables. I need to write a function because I am using…
Josh J
  • 21
  • 1
  • 4
2
votes
1 answer

How to get query result from postgraphile running as a library

I have postgraphile running as an express middleware. For example: const pgMiddleware = postgraphile(pool, SCHEMA, postgraphileConfig); app.use(pgMiddleware); How to get or intercept the result of a query or mutation without having a separate…
Wes
  • 21
  • 1
2
votes
2 answers

How to use Node.js in Postgraphile mutations?

I am making an application that shows information about different users, which is taken from third party API. I save this information in my own format with multiple tables in PostgreSQL to keep track of any changes to the data and provide history of…
2
votes
1 answer

How to authenticate keycloak token using node js that calls postgraphile?

I'm new on node js, and the company that i work for needs a proof of concept about postgraphile, the situation is this: I created a node js mini server that uses postgraphile to access the data on postgres The mini server works fine and can return…
lschaves
  • 23
  • 1
  • 4
2
votes
2 answers

Can a return value from a function be named with a specific name for Postgraphile?

I have this function in PostgreSQL: CREATE FUNCTION it_exists( email text, name text ) RETURNS boolean AS $$ DECLARE _eva1 boolean; _eva2 boolean; BEGIN _eva1 := EXISTS(SELECT * FROM tableA AS A WHERE A.email = $1::citext); _eva2 :=…
2
votes
1 answer

Postgraphile -- makeExtendSchemaPlugin to add Viewer Type to schema -- Relay/Postgres

I'm new to Relay, GraphQL and Postgres and I'm trying to extend the auto-generated schema that PostGraphile creates to include the Viewer Type which is a staple of Relay. The example from their docs is probably enough for most people to work with…
Kirk Ross
  • 6,413
  • 13
  • 61
  • 104
2
votes
2 answers

How to implement complex permission based data access in Postgres with Postgraphile or alternatives

For a new project, we're currently designing a database and an API to access this. We've already established we'll be using PostgresQL for the database, and want to access it via a GraphQL API. To ease with maintainability, we looked at several…
TJHui
  • 41
  • 7
2
votes
1 answer

Querying a many:many relationship on PK of the related table (ie. filtering by related table column)

I have a many:many relationship between 2 tables: note and tag, and want to be able to search all notes by their tagId. Because of the many:many I have a junction table note_tag. My goal is to expose a computed field on my Postgraphile-generated…
Tycholiz
  • 1,102
  • 4
  • 17
  • 33
2
votes
0 answers

React-admin: The dataProvider threw an error. It should return a rejected Promise instead.- Trying to setup referential integrity in the pg database

I am setting up react-admin as a dashboard for a burger restaurant. Here is my My github repository. I would like to apologize if any required troubleshooting information is missing. I am a bit out of my depth but I am having a go. I have created…
caston
  • 159
  • 12
2
votes
1 answer

In Postgraphile, How Can I Simplify the API?

Using Postgraphile, let's say I am querying all Foos, ie. allFoosList. Let's also say my Foo table has a many-to-many relationship with a Bar table in my database (ie. my Foos have Bars). In my results I will get back an array of Foo objects. …
machineghost
  • 33,529
  • 30
  • 159
  • 234
2
votes
0 answers

Postgraphile: multiple foreignkeys on same table with smart tags and postgraphile.tags.json5

NodeJS Project with apollo/postgraphile I would like to add multiple virtual foreignkey on multiple tables with postgraphile Smart Tags using postgraphile.tags.json5 If i do this in postgraphile.tags.json5 tags: { foreignKey: "(col1_id) REFERENCES…
Lucas Dmnt
  • 251
  • 1
  • 4
  • 15
2
votes
1 answer

Postgraphile change field case in schema

Is there any way to make all the fields in postgraphile schema lowercase even if the database fields are camelCased (i.e customerName => customername)?
Wojciech Owczarczyk
  • 5,595
  • 2
  • 33
  • 55
2
votes
1 answer

Postgraphile: Only some parameters in a function required

When I write a function in Postgresql I can add strict resulting in all parameters being required in Graphql (!), without strict all parameters are optional. On required fields in the non strict function I can throw exceptions or simply return null…
Jonathan
  • 1,355
  • 14
  • 22