Skip to content

fix(mysql): avoid invalid pagination after semicolons #388

Closed

Description

@Stiwar0098

Bug Description

MariaDB/MySQL queries fail when Tabularis appends pagination after a statement terminator. The generated SQL places \LIMIT/OFFSET\ after \;\, which MariaDB parses as a separate invalid fragment.

Examples

\\\sql
SELECT DATABASE() AS current_db;
-- becomes invalid near: LIMIT 2 OFFSET 0
\\\

\\\sql
SELECT ROUTINE_NAME
FROM information_schema.ROUTINES
WHERE ROUTINE_SCHEMA = DATABASE()
AND ROUTINE_NAME IN (...)
ORDER BY ROUTINE_NAME;
-- becomes invalid near: LIMIT 51 OFFSET 0
\\\

Expected Behavior

Pagination should be appended inside the SQL statement, before any effective statement terminator, while preserving user \LIMIT/OFFSET\ semantics.

Actual Behavior

Pagination can be appended after a semicolon, producing MariaDB syntax errors like:

\\\
error returned from database: 1064 (42000): You have an error in your SQL syntax ... near 'LIMIT 2 OFFSET 0'
\\\

Verification

  • \cargo test drivers::common::tests::test_build_paginated_query --lib\
  • Result: 31 passed
  • Cargo.toml/Cargo.lock restored after the temporary OpenSSL test workaround.

Activity

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