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