Prisma1: Multiple pgRelation on connect mutation

Created on 8 Sep 2018  路  8Comments  路  Source: prisma/prisma1

Describe the bug
Cannot run mutation when using multiple connect on relationships pgRelation in one table.

To Reproduce

type User {
  id: Int! @unique
  post: Post @pgRelation(column: "post_id")
  book: Book @pgRelation(column: "book_id")
  stats: Stats @pgRelation(column: "stats_id")
}

Then run this query:

createUser(data: {
  post: { connect: { id: 1 } }
  book: { connect: { id: 1 } }
  stats: { connect: { id: 1 } }
}) {
  id
}

Expected behavior
Should return a user and work like it works without existing database.

Logs


Log of Prisma

org.postgresql.util.PSQLException: ERROR: null value in column "user_id" violates not-null constraint
  Detail: Failing row contains (138, null, null, null, 1.0000, 0).
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:144)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
        at com.prisma.api.connector.jdbc.database.BuilderBase.$anonfun$insertReturningGeneratedKeysToDBIO$1(BuilderBase.scala:59)
        at com.prisma.api.connector.jdbc.database.BuilderBase.$anonfun$jooqToDBIO$1(BuilderBase.scala:82)
        at slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)
        at slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)
        at slick.basic.BasicBackend$DatabaseDef$$anon$2.liftedTree1$1(BasicBackend.scala:275)
        at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:275)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Versions (please complete the following information):

  • OS: Windows 10 Using Docker Container
  • prisma CLI: prisma/1.15.3 (x64) node-v10.9.9
  • Prisma Server: 1.15.3
bu0-needs-info areconnectopostgres areengine statustale

Most helpful comment

I think this issue should be reopened. I have the same issue still.

All 8 comments

Can you share instructions that create the Postgres database, so I can reproduce this?

It's the same thing that happens to me and I reported it here #3319 with an example and everything, I hope you will find a solution soon, thank you.

I am also having this issue, along with #3319 .

I have been following this and am experiencing the same issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

I think this issue should be reopened. I have the same issue still.

This is related to this one: https://github.com/prisma/prisma/issues/3319

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schickling picture schickling  路  3Comments

hoodsy picture hoodsy  路  3Comments

marktani picture marktani  路  3Comments

ragnorc picture ragnorc  路  3Comments

dohomi picture dohomi  路  3Comments