Describe the bug
I am getting this error when attempting to run a mutation with the following model:
datamodel.graphql
type Category @pgTable(name: "category") {
id: ID! @unique
createdAt: DateTime!
description: String
name: String! @unique
updatedAt: DateTime!
tags: [Tag!]!
}
type Tag @pgTable(name: "tag") {
id: ID! @unique
category: Category @pgRelation(column: "category_id")
createdAt: DateTime!
description: String
name: String! @unique
updatedAt: DateTime!
}
When running this mutation:
mutation {
createTag(data:{ name: "SomeTag", category:{
connect:{
name:"Missing"
}
}}){
id
name
}
}
I get the following error:
{"key":"error/unhandled","requestId":"local:api:cjjhb9vak006r08795veioykf","clientId":"default$default","payload":{"exception":"org.postgresql.util.PSQLException: ERROR: cached plan must not change result type","query":"mutation {\n createTag(data: {name: \"SomeTag\", category: {connect: {name: \"Missing\"}}}) {\n id\n name\n }\n}\n","variables":"{}","code":"0","stack_trace":"org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)\\n org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)\\n org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)\\n org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)\\n org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)\\n org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)\\n org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:144)\\n com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)\\n com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)\\n com.prisma.api.connector.postgresql.database.PostgresApiDatabaseMutationBuilder.$anonfun$createDataItem$1(PostgresApiDatabaseMutationBuilder.scala:50)\\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\\n slick.dbio.DBIOAction$$anon$1.$anonfun$run$1(DBIOAction.scala:187)\\n scala.collection.Iterator.foreach(Iterator.scala:929)\\n scala.collection.Iterator.foreach$(Iterator.scala:929)\\n scala.collection.AbstractIterator.foreach(Iterator.scala:1417)\\n scala.collection.IterableLike.foreach(IterableLike.scala:71)\\n scala.collection.IterableLike.foreach$(IterableLike.scala:70)\\n scala.collection.AbstractIterable.foreach(Iterable.scala:54)\\n slick.dbio.DBIOAction$$anon$1.run(DBIOAction.scala:187)\\n slick.dbio.DBIOAction$$anon$1.run(DBIOAction.scala:184)\\n slick.basic.BasicBackend$DatabaseDef$$anon$2.liftedTree1$1(BasicBackend.scala:240)\\n slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:240)\\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\\n java.lang.Thread.run(Thread.java:748)","message":"ERROR: cached plan must not change result type"}}
Expected behavior
No errror message appears and the mutation is executed successfully
Versions (please complete the following information):
Ubuntu 18.04prisma CLI: prisma/1.11.0 (darwin-x64) node-v10.5.01.11.0Thanks a lot, I'll look into reproduction soon! 馃檪
Note that I turned off mutations on this and was using a pre existing database
Here is a reproduction repo ;) https://github.com/jptissot/prismabugrepro
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@jptissot : Thanks for providing such a thorough reproduction! 馃檹 I was able to reproduce your issue with your repo. As a next step i upgraded to our most recent version 1.15.1, as your example was running 1.11. In this version everything works just fine. We did some improvements in the last releases for the support of existing databases so we fixed it already in one of those.
Closing this therefore now. Just reopen if you think it is necessary.
Most helpful comment
@jptissot : Thanks for providing such a thorough reproduction! 馃檹 I was able to reproduce your issue with your repo. As a next step i upgraded to our most recent version
1.15.1, as your example was running1.11. In this version everything works just fine. We did some improvements in the last releases for the support of existing databases so we fixed it already in one of those.Closing this therefore now. Just reopen if you think it is necessary.