fix(page-data): grant agent role set permission

This commit is contained in:
john
2026-07-17 09:32:31 +08:00
parent 331a863288
commit a5d109d585
6 changed files with 81 additions and 2 deletions
+5
View File
@@ -1,6 +1,7 @@
import pg from 'pg';
import {
buildControlSchemaSql,
buildEnsureCurrentUserCanSetRoleSql,
deriveUserSpaceNames,
provisionUserSpace,
quotePgIdentifier,
@@ -107,6 +108,10 @@ export function createPostgresUserDataSpaceService(options = {}) {
await client.query('ROLLBACK');
throw error;
}
} else {
// PostgreSQL 17 grants CREATEROLE owners ADMIN but not SET by default.
// Reconcile existing spaces before the runtime executes SET LOCAL ROLE.
await client.query(buildEnsureCurrentUserCanSetRoleSql(names.agentRole));
}
provisionedUsers.add(names.userId);
} finally {