mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
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
This commit is contained in:
@@ -134,8 +134,9 @@ async fn test_context(args: &TestArgs) -> Result<TestContext<Postgres>, Error> {
|
||||
// I couldn't find a bug on the mailing list for `CREATE SCHEMA` specifically,
|
||||
// but a clearly related bug with `CREATE TABLE` has been known since 2007:
|
||||
// https://www.postgresql.org/message-id/200710222037.l9MKbCJZ098744%40wwwmaster.postgresql.org
|
||||
// magic constant 8318549251334697844 is just 8 ascii bytes 'sqlxtest'.
|
||||
r#"
|
||||
lock table pg_catalog.pg_namespace in share row exclusive mode;
|
||||
select pg_advisory_xact_lock(8318549251334697844);
|
||||
|
||||
create schema if not exists _sqlx_test;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user