Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: show ddl/dml error modal (#19351)

ecmadao2a55da6f07cf
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
index 8b76ae408f..6fb781b994 100644
--- a/frontend/src/composables/useExecuteSQL.ts
+++ b/frontend/src/composables/useExecuteSQL.ts
@@ -332,7 +332,7 @@ const useExecuteSQL = () => {
flattenNoSQLResult(resultSet);
}
- if (isOnlySelectError(resultSet)) {
+ if (isDisallowChangeDatabaseError(resultSet)) {
// Show a tips to navigate to issue creation
// if the user is allowed to create issue in the project.
if (
@@ -359,8 +359,8 @@ const useExecuteSQL = () => {
};
};
-const isOnlySelectError = (resultSet: SQLResultSetV1) => {
- return resultSet.results.some((result) => {
+const isDisallowChangeDatabaseError = (resultSet: SQLResultSetV1) => {
+ const isCommandError = resultSet.results.some((result) => {
return (
result.detailedError.case === "commandError" &&
[
@@ -370,6 +370,18 @@ const isOnlySelectError = (resultSet: SQLResultSetV1) => {
].includes(result.detailedError.value.commandType)
);
});
+ if (isCommandError) {
+ return true;
+ }
+
+ return resultSet.results.some((result) => {
+ if (result.detailedError.case === "permissionDenied") {
+ return result.detailedError.value.requiredPermissions.some((p) => {
+ return p === "bb.sql.ddl" || p === "bb.sql.dml";
+ });
+ }
+ return false;
+ });
};
export { useExecuteSQL };