Skip to content

Generates invalid MySQL query #127

@jelder

Description

@jelder

What happens?

duckdb-mysql will generate invalid WHERE clauses for trivial SELECT queries.

To Reproduce

Attach a MySQL database and issue a SELECT query which includes a WHERE clause, ORDER clause, and LIMIT clause. The bug seems to require all three clauses to be present.

attach 'host=1.2.3.4 db=my_db' AS remote_mysql (TYPE mysql, READ_ONLY);

-- This succeeds:
from mysql_query(abacus, 'select * from users where id > 10 order by id limit 10');

-- This fails:
from remote_mysql.users where id > 10 order by id limit 10;
IO Error:
Failed to run query "SELECT `id`, `email`, `name`, `created_at`, `updated_at` FROM 
`my_db`.`users` WHERE (`id` > 10 AND )": You have an error in your SQL syntax; check 
the manual that corresponds to your MySQL server version for the right syntax to use 
near ')' at line 1

OS:

macOS

MySQL Version:

8.0.26-google

DuckDB Version:

v1.2.2 7c039464e4

DuckDB Client:

CLI

Full Name:

Jacob Elder

Affiliation:

Paccurate

Have you tried this on the latest main branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree

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