Skip to content

[BUG] JSQLParser 5.4-SNAPSHOT : MySQL : PROCEDURE ANALYSE() not supported in SELECT statements #2428

@tomershay

Description

@tomershay

Failing SQL Feature

MySQL PROCEDURE ANALYSE() clause used in SELECT statements.

MySQL (notably in older versions such as 5.5) supports PROCEDURE ANALYSE() as a query modifier that analyzes a result set and suggests optimal column types and sizes. It is appended directly to a SELECT statement and returns metadata instead of modifying data.

Although seems to be deprecated and removed in modern MySQL versions, it is still valid syntax in legacy mysql databases and may appear in migration scenarios or older production systems.

SQL Example

CREATE TABLE heavy_table (
    id INT AUTO_INCREMENT PRIMARY KEY,
    col1 INT,
    col2 VARCHAR(50)
);

INSERT INTO heavy_table (col1, col2) VALUES
(10, 'alpha'),
(20, 'beta'),
(10, 'gamma');

SELECT col1, col2
FROM heavy_table
PROCEDURE ANALYSE(10, 256);

Parsing error

ParseException: Encountered: <S_IDENTIFIER> / "ANALYSE", at line 1, column 46, in lexical state DEFAULT.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions