question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.3.4-beta.1 select relations results in "database query error"

See original GitHub issue

This results in an error:

mutation {
  update_smth_by_pk(pk_columns: { id: 1 }, _set: ...) {
    id
    rel {
      id
    }
  }
}

Update: the errors appears only for update_by_pk mutations, update(where..) { returning { ... } } works

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
nicuveocommented, Nov 30, 2020

Found the issue! This was caused by an error in the way we construct our internal representation of “by pk” mutations (the error was also present in delete_by_pk). For the issue to arise, however, two conditions needed to be met:

  • a relation is present in the mutation output
  • the user does not have select permissions on all columns of the modified table

I’ve opened a PR on our internal repo that fixes this bug, it’ll be included in 1.3.4.

0reactions
webdebcommented, Dec 2, 2020

@nicuveo great job!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database Engine events and errors - SQL Server
For a full list of all errors, query the sys.messages catalog view ... The number of SELECT values must match the number of...
Read more >
What is the "N+1 selects problem" in ORM (Object-Relational ...
The N+1 query problem happens when the data access framework executed N ... database tables which form a one-to-many table relationship:.
Read more >
Basic queries: SQL and RA
In SQL, to retrieve data stored in our tables, we use the SELECT statement. ... While the result may look like a table,...
Read more >
Learn SQL: Types of relations - SQLShack
One of the most important things in databases is to understand the types of relations in the databases.
Read more >
Active Record Query Interface - Rails Edge Guides
How to use eager loading to reduce the number of database queries needed for data ... SELECT * FROM customers WHERE (customers.orders_count NOT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found