Screens: SQL editor

Dangerous SQL confirmation

The SQL editor shows a confirmation window just before running a statement that deletes data in bulk or removes a table. This page explains the window's look and buttons, and which confirmation applies to each execution path. The overall picture of which safeguard applies to which execution is in Safeguards for production databases.

Where you can use itWebDesktopWithout signing inSigned inLocal projectsAccount projects

What's on the screen

No.NameDescription
1TitleThe Dangerous Operation title when there is a TRUNCATE, DROP or ALTER … DROP, and the Confirm Execution title when there are only UPDATE or DELETE statements without WHERE.
2ReasonWhy the window appeared: the reasons in the table below, followed by Execute this statement?. When several statements run, the beginning of each matching statement is shown too.
3Don't ask again for this type on this connection checkboxIf checked when you run, this type is not asked again on the same connection until the app restarts (on the web, until the page is reloaded). Other connections and other projects are not affected. It starts unchecked.
4Cancel buttonCloses the window without running. The focus is on this button when the window opens, so pressing Enter without reading the window does not run the statement.
5Execute buttonRuns the statement.

The statements that bring up the window and their reasons are as follows.

StatementReason
A statement starting with TRUNCATETRUNCATE statement
A statement starting with DROP (all of them, such as DROP TABLE, DROP VIEW and DROP PROCEDURE)DROP statement
An ALTER that removes something, such as ALTER TABLE … DROP COLUMNALTER … DROP statement (drops a column, constraint, etc.)
UPDATE without WHERE (including one that starts with WITH)UPDATE without WHERE clause
DELETE without WHERE (including one that starts with WITH)DELETE without WHERE clause
  • Text inside comments and strings is ignored. A WHERE inside a subquery does not filter the target rows, so it does not count as a WHERE.
  • It appears on every connection, regardless of the connection profile.

Confirming and running

  1. In a SQL tab, put the cursor in the statement and click the Execute button (Ctrl+Enter, Cmd+Enter on macOS). If the statement has bind parameters, the window for entering values opens first (Bind parameters), and the statement with the values filled in is checked.
  2. When the window appears, read the reason and check that the statement in the editor and the tab's run target (connection, database, schema) are right.
  3. To run it, click the Execute button; to stop, click the Cancel button. Clicking outside the window or pressing Esc does not close it.

Before showing the window, the following checks run in order. A check that blocks stops without asking, so a statement is never blocked after you confirmed it.

OrderCheckIf it applies
1Role-based DDL restriction (account projects)Does not run, and shows the DDL execution is restricted. Please request the approver to apply it to the DB. notice
2Protection mode of the connection profileBlocks if read-only; if confirm, shows the window in 'The protection mode confirmation' below
3Dangerous SQL confirmationAsks. If step 2 already shows a window, both are asked in that one window

The protection mode confirmation

On a connection whose profile protection mode is Confirm (DDL + risky DML), this window appears before DDL and UPDATE or DELETE without WHERE run. The Staging and Prod environments start in this mode (Connection profiles).

  • The title (1) is the environment's English name in capitals and the connection name, as in [PROD] shop-db. For a profile whose environment is Custom, the PROTECTED label takes the environment's place.
  • The reason (2) is Schema change (DDL) on a protected connection. for DDL and UPDATE/DELETE without a WHERE clause on a protected connection. for UPDATE or DELETE without WHERE. If the statement also triggers the dangerous SQL confirmation, that reason is shown in the same window.
  • It runs only when you click the Execute button (3). The initial focus is on the Cancel button. This window has no Don't ask again for this type on this connection checkbox, so a type you stopped confirming is still asked on protected connections.
  • When you run several statements with the Run Script button, the matching statements are gathered and you are asked once before running. The line below the reason is Run this script?.
  • Paths outside the SQL editor that write to the database, such as applying result edits or applying an ERD to the database, ask in the same window. The button there is the Apply button, and the line is Apply these changes to the database?.

How read-only connections block statements

On a connection whose protection mode is Read-only (block non-SELECT), running a statement that is not a query does not run it and shows a red notice at the top of the screen. No window asks you anything.

StatementNotice
DDLDDL statements are blocked on read-only connections.
Other statements that change dataStatements that change data are blocked on read-only connections.
  • The Run Script button does not run the script at all if any statement is blocked.
  • A statement that also triggers the dangerous SQL confirmation, such as DELETE FROM coupon, is blocked right away without that window.
  • Whether a statement is a query is decided by looking into its body. The rule is explained in Safeguards for production databases.

Confirmations on each execution path

The dangerous SQL confirmation appears when you run with the Execute button of the SQL editor (including the shortcut and Execute Statement in the editor's right-click menu) and with the Run Script button. Protection mode applies to every path that writes to the database.

Execution pathDangerous SQL confirmationProtection mode
The Execute buttonAppearsApplies
The Run Script buttonAppears. Matching statements are gathered and asked onceApplies
Applying result grid edits (including choosing to apply when closing a tab, and the data tabs of tables and objects)Does not appear. The Preview Data Changes window shows the SQL to run firstApplies
Applying an ERD to the database, saving a table, changing and deleting objects in the explorerDoes not appear. Each screen shows the SQL to run firstApplies
Importing data from files, restoring dump filesDoes not appearApplies
SQL run by the AI Assistant panelDoes not appearApplies
SQL sent by external MCP clientsDoes not appearApplies to every statement

Things to keep in mind

  • The dangerous SQL confirmation looks only at the shape of the statement. A statement that changes every row despite having a condition, such as a DELETE with WHERE 1=1, runs without the window.
  • If you select several statements and click the Execute button, the selected text is sent at once, but each statement is checked. If any one of them applies, you are asked.
  • When changing data on a production database, turn off the Auto Commit switch, run, check the result and then commit (SQL execution and transactions).