bytebase/bytebase · error

meet unsupported table statement with into

Error message

meet unsupported table statement with into

What it means

The MySQL/OMNI query span extractor refuses TABLE ... INTO statements. TABLE statements are a shorthand for SELECT * FROM tbl, and when they carry an INTO clause they write rows to a variable or file, which the extractor cannot model for lineage. It fails closed instead of returning wrong column spans.

Source

Thrown at backend/plugin/parser/mysql/query_span_extractor_omni.go:161

		return nil, err
	}
	q.tableSourceFrom = append(q.tableSourceFrom, fromSources...)

	results, err := q.extractOmniTargetList(stmt.TargetList, fromSources)
	if err != nil {
		return nil, err
	}
	return &base.PseudoTable{
		Columns: results,
	}, nil
}

func (q *omniQuerySpanExtractor) extractOmniTableStmt(stmt *ast.TableStmt) (*base.PseudoTable, error) {
	if stmt == nil || stmt.Table == nil {
		return &base.PseudoTable{}, nil
	}
	if stmt.Into != nil {
		return nil, errors.New("meet unsupported table statement with into")
	}
	tableSource, err := q.findTableSchema(stmt.Table.Schema, stmt.Table.Name)
	if err != nil {
		return nil, err
	}
	return &base.PseudoTable{Columns: tableSource.GetQuerySpanResult()}, nil
}

func (q *omniQuerySpanExtractor) extractOmniValuesStmt(stmt *ast.ValuesStmt) (*base.PseudoTable, error) {
	if stmt == nil || len(stmt.Rows) == 0 {
		return &base.PseudoTable{}, nil
	}
	var columns []base.QuerySpanResult
	for _, expr := range stmt.Rows[0] {
		field, err := q.extractOmniExpr(expr)
		if err != nil {
			return nil, err
		}

View on GitHub (pinned to 1870550677)

Solutions

  1. Remove the INTO clause from the TABLE statement
  2. Rewrite TABLE tbl INTO ... as the explicit form SELECT * FROM tbl (without INTO) before extraction
  3. Pre-scan statements for TABLE ... INTO and route them away from span extraction

Example fix

// before
TABLE users INTO @rows;
// after
SELECT * FROM users;
Defensive patterns

Strategy: validation

Validate before calling

// reject TABLE ... INTO before extraction
if /^\s*TABLE\s+\S+\s+INTO\b/i.test(stmt) { throw new Error('TABLE ... INTO is not supported for lineage') }

Try / catch

span, err := extractor.Extract(sql)
if err != nil {
    if strings.Contains(err.Error(), "table statement with into") {
        return nil, fmt.Errorf("rewrite %q as SELECT * FROM ...", sql)
    }
    return nil, err
}

Prevention

When it happens

Trigger: Query span extraction encounters a *ast.TableStmt whose Into field is non-nil, e.g. TABLE users INTO @x. Reached from extractOmniSelectRoot or extractOmniSelectStmt when a TABLE statement appears as the query body or inside a set operation.

Common situations: Ingesting MySQL 8.0+ TABLE shorthand syntax through lineage tooling, especially scripts written with INTO for variable capture or file dumps.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06). Data as JSON: /api/errors/406c3b315d7fdb3d. Report an issue: GitHub.