Skip to content

Wrong queries created by builder #118

@mgrechanik

Description

@mgrechanik

What steps will reproduce the problem?

        $query = new \yii\sphinx\Query();
        $query->select('id, name, entity_id, entity_type')->
                from('all');
//...
$query->match(new Expression(':match', ['match' => $str]));

What's expected?

SQL like:

SELECT `id` , `name` , `entity_id` , `entity_type`  FROM `all` WHERE MATCH('dddddddd* ')

What do you get instead?

SELECT `id` AS `id`, `name` AS `name`, `entity_id` AS `entity_id`, `entity_type` AS `entity_type` FROM `all` WHERE MATCH('dddddddd* ')

And such sql - with aliases which are the same with fields they are for - does not work for sphinx 2.3.2 and two other earlier versions.
One can try such sphinx sql in console, the one with such aliases does not work.
The error is this one:

ERROR 1064 (42000): sphinxql: syntax error, unexpected ID near '`id`, `name` AS `name`, `entity_id` AS `entity_id`, `entity_type` AS `entity_type` FROM `all` WHERE MATCH('sss')'

Additional info

Q A
Yii version 2.0.32
Yii Sphinx version 2.0.11
Sphinx server version 2.3.2
PHP version 7.3.
Operating system Ubuntu 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions