Prisma1: 'ERROR: missing FROM-clause entry for table' when querying nested nodes

Created on 22 Aug 2018  路  5Comments  路  Source: prisma/prisma1

Describe the bug

Querying nested nodes results in error

org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "Session_TaskGroup_Task_Alias"

To Reproduce

  1. Setup Prisma 1.14.2 with latest PostgreSQL database

  2. Schema:

type Session {
    id: ID! @unique,
    taskGroups: [TaskGroup!]! @relation(name: "TaskGroupsForSession", onDelete: CASCADE)
}

type TaskGroup {
    id: ID! @unique,
    session: Session!  @relation(name: "TaskGroupsForSession"),
    tasks: [Task!]! @relation(name: "TasksForTaskGroups", onDelete: CASCADE)
}

type Task {
    id: ID! @unique,
    taskGroup: TaskGroup! @relation(name: "TasksForTaskGroups"),
    template: Template @relation(name: "TemplateForTask", onDelete: CASCADE)
}

type Template {
    id: ID! @unique,
    task: Task @relation(name: "TemplateForTask")
}
  1. Seed with some data

  2. Query

This works:

query templates(where:
  task: {
    taskGroup: {
      id: "abc"
    }
  }
){
  id
}

But this doesn't:

query templates(where:
  task: {
    taskGroup: {
      session: {
        id: "xyz"
      }
    }
  }
){
  id
}

Expected behavior
Query should succeed.

Versions (please complete the following information):
Prisma 1.14.2 with latest PostgreSQL database


* Error output *

prisma_1 | [Bugsnag - local / testing] Error report: com.bugsnag.Report@646c63d8
prisma_1 | org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "Session_TaskGroup_Task_Alias"
prisma_1 | Position: 493
prisma_1 | at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
prisma_1 | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
prisma_1 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
prisma_1 | at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
prisma_1 | at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
prisma_1 | at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
prisma_1 | at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:118)
prisma_1 | at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
prisma_1 | at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
prisma_1 | at com.prisma.api.connector.jdbc.database.BuilderBase.$anonfun$queryToDBIO$1(BuilderBase.scala:51)
prisma_1 | at com.prisma.api.connector.jdbc.database.BuilderBase.$anonfun$jooqToDBIO$1(BuilderBase.scala:81)
prisma_1 | at slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)
prisma_1 | at slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)
prisma_1 | at slick.basic.BasicBackend$DatabaseDef$$anon$2.liftedTree1$1(BasicBackend.scala:275)
prisma_1 | at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:275)
prisma_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
prisma_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
prisma_1 | at java.lang.Thread.run(Thread.java:748)

bu1-repro-available

Most helpful comment

Thanks for reporting and providing thorough descriptions! 馃檹 We fixed this issue and it is available in version 1.15.2 馃帀 . The build will be available in a few minutes.

All 5 comments

@Jaszkowic Were you able to find a workaround? This issue is currently preventing me from upgrading to 1.14+.

@joefru No, unfortunately not. I downgraded to 1.12.0 for now. But i think it would work to perform the nested query one by one, e.g. query task, then query taskGroup from task, then query session from taskGroup etc. But it would involve a lot of manual filtering.

I have the same problem with Prisma 1.14.0: org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "Recipient_Alias". So the only solution for now is downgrading?

To me, this issue is critical. How is anyone with more than the simplest of applications using version 1.14+? All those performance improvements... want them sooo bad! 馃槃

Thanks for reporting and providing thorough descriptions! 馃檹 We fixed this issue and it is available in version 1.15.2 馃帀 . The build will be available in a few minutes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MitkoTschimev picture MitkoTschimev  路  3Comments

akoenig picture akoenig  路  3Comments

schickling picture schickling  路  3Comments

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments