Page MenuHomePhabricator

SQL Optimizer returns an error for a valid SQL query
Open, Needs TriagePublic

Description

Please see https://tools.wmflabs.org/sql-optimizer?use=enwiki_p&sql=select+distinct+page_id%0D%0Afrom+page

The SQL query provided there is valid, yet a MariaDB error about its syntax is returned by Toolforge SQL Optimizer.

Event Timeline

Huji created this task.Fri, Sep 20, 2:44 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFri, Sep 20, 2:44 AM
JJMC89 edited projects, added Tools; removed Toolforge.Fri, Sep 20, 2:48 AM
JJMC89 added a subscriber: MusikAnimal.

SQL Optimizer works by putting a SLEEP(1) in the query and EXPLAINing the query using the process ID. It is only but so smart, unfortunately. Here it went with:

SELECT SLEEP(1), DISTINCT page_id
FROM page

which won't work. I guess if there's only a DISTINCT [field name] in the select clause, we need to put the SLEEP(1) after it, not before.