Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign updiesel::debug_query doesn't show the RETURNING part of query when used with PostgreSQL #1249
Comments
This comment has been minimized.
|
There's not really anything we can do here. |
sgrif
closed this
Oct 9, 2017
This comment has been minimized.
blazern
commented
Oct 10, 2017
•
|
@sgrif, is there a way to see the full query used by Diesel though? |
This comment has been minimized.
|
My last comment described how to see the full query, depending on whether it is run with |
blazern commentedOct 9, 2017
•
edited
Setup
Versions
Feature Flags
Problem Description
Created an PostgreSQL table and a user, the user was granted only with INSERT privilege.
Used
infer_schemato generate wrappers and correct URL to connect to the local DB.Executed:
which failed with
DieselError(DatabaseError(__Unknown, "permission denied for relation my_table_name").Tried to insert the same value manually by
psql- the insertion worked.Decided to use
diesel::debug_queryto see what query Diesel used to INSERT.Executed:
Which printed out:
Tried to execute this very query manually by
psql- manual insertion worked, while insertion by Diesel failed.Opened PostgreSQL logs, and there was the real query which Diesel used:
The
RETURNINGclause was the problem - it requiresSELECTprivilege, but the user I used had onlyINSERTprivilege.If
diesel::debug_queryshown the correct query I wouln't have to look it up in the logs.Checklist