-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: log SQL query commands to stderr #3904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
37f0516
to
5e9c360
Compare
5e9c360
to
d5f7ca7
Compare
c391a04
to
b141cd3
Compare
e8970e4
to
498b4fd
Compare
Could you explain how you obtain the SQL? Did you had to convert |
Ah, I see now that when using dynamicallyParameterized that already outputs the generated sql as part of the |
Feature looks great, very useful even for us when developing. But looking at the code, it doesn't look like it's left in a good state.
I wonder if this could look better with an additional step in |
That was my idea initially, but I found out that I cannot make it further above the postgrest/src/PostgREST/App.hs Lines 148 to 151 in 498b4fd
A single declaration for
This can also be done directly in
I think the SQL as |
Hm, so it seems to me the above is not an issue. I was thinking that the way to do this is to split the If it's too much work now, maybe it can be commented as TODO. |
498b4fd
to
c93c25f
Compare
Oh, I think I understand. I was trying to do something similar but, had problems with the pattern matching leaving unreachable paths fot the OpenAPI case. Although, It should be possible once |
This doesn't generate the I think some other extra queries we run for the |
It also doesn't log our transactional variables. The bunch of |
So it only logs the Main query, which is really the most important part. I think most admins will only want to look at that. Now I'm thinking if we should have different values of Otherwise I think it's gonna require a major refactor to truly log all the SQL. |
- Logs the main SQL query when `log-query=true`. - Only logs at the current `log-level`.
c93c25f
to
9ce9603
Compare
WIP
Resolves #1578.
Implements what was mentioned in #1578 (comment)
In summary:
log-query
boolean configuration valuelog-level
specified.log-level=warn
andlog-query=true
will log a400
HTTP error and also the SQL query. But a200
HTTP response will not log neither the request nor the SQL query.Example