fix(vastbase): avoid backslash escape in role grants SQL

This commit is contained in:
t8y2 2026-06-26 19:07:03 +08:00
parent 10aff74072
commit 8732075dc9
2 changed files with 3 additions and 1 deletions

View File

@ -244,7 +244,7 @@ FROM (
)
FROM target t
CROSS JOIN pg_catalog.pg_namespace n
WHERE n.nspname NOT LIKE 'pg\\_%' ESCAPE '\\'
WHERE n.nspname NOT LIKE 'pg~_%' ESCAPE '~'
AND n.nspname <> 'information_schema'
AND (has_schema_privilege(t.rolname, n.oid, 'USAGE') OR has_schema_privilege(t.rolname, n.oid, 'CREATE'))
UNION ALL

View File

@ -172,4 +172,6 @@ test("builds PostgreSQL role metadata SQL without directly requiring rolbypassrl
assert.doesNotMatch(listSql, /r\.rolbypassrls/);
assert.doesNotMatch(grantsSql, /r\.rolbypassrls/);
assert.match(grantsSql, /AS rolbypassrls/);
assert.match(grantsSql, /n\.nspname NOT LIKE 'pg~_%' ESCAPE '~'/);
assert.ok(!grantsSql.includes("ESCAPE '\\'"));
});