shadowhand/latitude

Select with tableA.* and tableB.field issue

nitroponiesnetwork opened this issue · 1 comments

Greetings,

First, thank you for this amazing query builder.
While writting some specific case, I encountered an issue and haven't found anything matching it on the docs.

Let's imagine we want to get all fields from a table and specific fields from another one, in a joint query.
I'd do something like this :

$this->builder->select(
            'a.*',
            'b.field_x',
            'b.field_y',
            'b.field_z'
)

Unfortunately, the query builder is adding the backquotes around the *, as shown on this dump :

SELECT `a`.`*`, `b`.`field_x`, `b`.`field_y`, `b`.`field_z`

which obviously lead to this error :

Column not found: 1054 Unknown column 'a.*' in 'field list'

Atm my only way to make this query work is to use

str_replace(".`*`", ".*", $queryBuilder->sql())

Did I missed something ? If not, I guess the * should be an exception to the "back quote everything" rule !

Fixed in version 3.3.1.