Skip to content

Commit a9dfb4f

Browse files
authored
Avoid privilege requirements by using an advisory lock in test setup (postgres). (#3753)
* feat(sqlx-postgres): use advisory lock to avoid setup race condition * fix(sqlx-postgres): numeric hex constants not supported before postgres 16
1 parent 8dce6bd commit a9dfb4f

File tree

1 file changed

+2
-1
lines changed
  • sqlx-postgres/src/testing

1 file changed

+2
-1
lines changed

sqlx-postgres/src/testing/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ async fn test_context(args: &TestArgs) -> Result<TestContext<Postgres>, Error> {
134134
// I couldn't find a bug on the mailing list for `CREATE SCHEMA` specifically,
135135
// but a clearly related bug with `CREATE TABLE` has been known since 2007:
136136
// https://www.postgresql.org/message-id/200710222037.l9MKbCJZ098744%40wwwmaster.postgresql.org
137+
// magic constant 8318549251334697844 is just 8 ascii bytes 'sqlxtest'.
137138
r#"
138-
lock table pg_catalog.pg_namespace in share row exclusive mode;
139+
select pg_advisory_xact_lock(8318549251334697844);
139140
140141
create schema if not exists _sqlx_test;
141142

0 commit comments

Comments
 (0)