Skip to content

Commit

Permalink
Merge pull request #4238 from systeminit/jhelwig/silence-not-in-trans…
Browse files Browse the repository at this point in the history
…action-rollback-warning

Temporarily silence PG warnings during connection setup
  • Loading branch information
jhelwig authored Jul 26, 2024
2 parents f004358 + 6bb8db6 commit 8e48a39
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/si-data-pg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ const TEST_QUERY: &str = "SELECT 1";
// holds on to connections and reuses them even if our services are restarted.
// We could avoid needing to discard plans by selecting exactly the columns we
// need instead of SELECT * (unless the column type changes!)
//
// We set `CLIENT_MIN_MESSAGES` to `ERROR` to silence the possible warning from `ROLLBACK` about
// there not being any open transaction. We immediately set it back to the default value
// (`WARNING`) after so we're not hiding any "real" warnings that might happen.
const CONNECTION_RECYCLING_METHOD: &str = r#"
SET CLIENT_MIN_MESSAGES TO ERROR;
ROLLBACK;
SET CLIENT_MIN_MESSAGES TO WARNING;
CLOSE ALL;
SET SESSION AUTHORIZATION DEFAULT;
RESET ALL;
Expand Down

0 comments on commit 8e48a39

Please sign in to comment.