Visitar URL original
OceanBase SQL Editor does not show Create Plan prompt for DDL in read-only mode · Issue #21170 · bytebase/bytebase · GitHub
Skip to content

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

Description

@Myifan610

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:

    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:

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)

Activity

  1. adela-bytebase commented on Aug 20, 2026

    @adela-bytebase
    Contributor

    Hi we've created an internal ticket to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions