-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(postgres): sqlx prepare fails if shared_preload_libraries=pg_stat_statements #2626
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
@@ -183,7 +183,7 @@ services: | |||
volumes: | |||
- "./postgres/setup.sql:/docker-entrypoint-initdb.d/setup.sql" | |||
command: > | |||
-c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key | |||
-c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key -c shared_preload_libraries=pg_stat_statements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if -c shared_preload_libraries=pg_stat_statements
should be added to other postgres containers
``` error: error occurred while decoding column 0: data did not match any variant of untagged enum Explain at line 3 column 1 Error: --> tests/postgres/macros.rs:103:15 | 103 | let row = sqlx::query!(r#"CALL forty_two(null)"#) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info) error: could not compile `sqlx` (test "postgres-macros") due to previous error ```
It seems enabling JIT in Postgres also adds another field to the explain output. Are we able to come up with a serde data structure which can utilize |
hi @valkum - thanks for noticing that. Actually with this changes, sqlx will explicitly access So in fact even defining |
/// The string "Utility Statement" -- returned for | ||
/// a CALL statement | ||
#[serde(rename = "Utility Statement")] | ||
UtilityStatement, | ||
UtilityStatement(String), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this enum variant is never used? Its definiton was changed, but I see no other code that had to be updated because of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, that's my understanding how it was working before my changes as well. I can include "clean up" refactor to this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so apparently it's required for compile-time checks agains DB - to match string:
error: error occurred while decoding column 0: data did not match any variant of untagged enum Explain at line 3 column 1
Error: --> tests/postgres/macros.rs:103:15
|
103 | let row = sqlx::query!(r#"CALL forty_two(null)"#)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `sqlx` (test "postgres-macros") due to previous error
Error: warning: build failed, waiting for other jobs to finish...
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 101
https://github.com/launchbadge/sqlx/actions/runs/5632237064/job/15260004403?pr=2626
pardon, @jplatte @abonander - is there anything that prevents merging this PR? |
I'm not a maintainer of sqlx, just a curious contributor 😅 |
closes #2622 #2587
related #1449
refs: