I'm using a postgraphql autogenerated mutation to create a row with graphql in a in a postgres table that has a column of datatype UUID[].
However, there doesn't seem to be a way to save this UUID[] data with graphql? Is this a datatype that graphql doesn't account for or am I wrongly forming the array?
When I go to create the row in graphiql:
mutation {
createJob(
input: {
user_ids: ["5b7323ac-e235-4edb-bbf9-97495d9a42a1"],
instructions: "Job Instructions",
publishedDate: "2017-06-07"}
}
)
}
I get the following error:
"message": "column \"user_ids\" is of type uuid[] but expression is of type text[]"
Is a UUID technically not stored like text? I've tried different ways of forming the the UUID array but nothing seems to work
You can probably have a workaround to this problem by creating an implicit cast:
PostgreSQL will automatically do the conversion from
text[]
touuid[]
; which just seems that is the needed step.NOTE: The above code must be executed from "the owner of type uuid[] or text[]", which usually means:
postgres
or the database owner.To check that it works, you may just do:
... and then, test it with
GraphQL