#21170·bytebase

OceanBase SQL Editor does not show Create Plan prompt for DDL in read-only mode

Author: Myifan610Created Aug 13, 2026Updated Aug 20, 2026

Description

In Bytebase v3.21.0, when DDL is executed from SQL Editor in read-only mode:

  • MySQL correctly shows the "Create Plan" prompt.

  • OceanBase returns a raw error instead:

    [unknown] invalid_argument: Support read-only command statements only

This prevents OceanBase users from being guided into the database change workflow.

Steps to reproduce

  1. Connect an OceanBase (MySQL mode) instance.

  2. Grant the user query access and permission to create database change plans.

  3. Configure SQL Editor so that DDL cannot be executed directly.

  4. Execute a DDL statement:

    sql
    CREATE TABLE bb_ddl_prompt_test (id INT);

Actual behavior

SQL Editor displays:

[unknown] invalid_argument: Support read-only command statements only

No Create Plan prompt is shown.

Expected behavior

The behavior should be consistent with MySQL: SQL Editor should show the action-required dialog and allow the user to create a database change plan with the current SQL statement.

Investigation

In v3.21.0, MySQL is included in EngineSupportQueryNewACL, while OceanBase is explicitly excluded:

  • backend/common/engine.go
  • backend/api/v1/sql_service.go

For OceanBase, Query() invokes validateQueryRequest() before normal query execution. A non-read-only statement is returned directly as a top-level InvalidArgument error:

go
errors.New("Support read-only command statements only")

Although validateQueryRequest() creates a queryError with command type NON_READ_ONLY, returning it before building QueryResponse.results prevents the frontend from receiving QueryResult_CommandError_NON_READ_ONLY.

The frontend only opens ExecutingHintModal when isDisallowChangeDatabaseError() finds a structured DDL/DML/NON_READ_ONLY command error or a missing bb.sql.ddl / bb.sql.dml permission.

This also appears unchanged on the current main branch.

Suggested direction

Return a structured QueryResult_CommandError_NON_READ_ONLY response for OceanBase, or otherwise ensure the frontend receives a recognizable error type that triggers the Create Plan dialog.

Version

  • Bytebase: v3.21.0
  • Database: OceanBase (MySQL mode)