Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Db\Sql\Platform\Oracle\SelectDecorator does not allow Select as join table #4316

cmay87 opened this Issue Apr 25, 2013 · 4 comments


None yet
3 participants

cmay87 commented Apr 25, 2013

While the Db\Sql\Select class allows an instance of Select to be passed as a join table, the SelectDecorator used in executing the query does not allow it. The issue is that it assumes the table name must be quoted, but an instance of select should not be quoted. Below is example code for how I quickly modified the framework code to allow me to keep moving in my project.

In processJoins...

        $joinSpecArgArray[$j][] = (is_array($join['name']))
            ? $platform->quoteIdentifier(current($join['name'])) . ' ' . $platform->quoteIdentifier(key($join['name']))
            : $platform->quoteIdentifier($join['name']);

I replaced with...

        $name = (is_array($join['name'])) ? (current($join['name'])) : $join['name'];
        if($name instanceof Select)
            $joinSpecArgArray[$j][] = (is_array($join['name']))
                ? '(' . $this->processSubselect($name, $platform, $driver, $parameterContainer) . ') ' . $platform->quoteIdentifier(key($join['name']))
                : '(' . $this->processSubselect($name, $platform, $driver, $parameterContainer) . ')';
            $joinSpecArgArray[$j][] = (is_array($join['name']))
                ? $platform->quoteIdentifier(current($join['name'])) . ' ' . $platform->quoteIdentifier(key($join['name']))
                : $platform->quoteIdentifier($join['name']);

@ghost ghost assigned ralphschindler Apr 25, 2013


ralphschindler commented Nov 15, 2013

Do you have a small reproduction case for this?

cmay87 commented Nov 29, 2013

It's been a while so I'll have to do some digging to find the use case that brought it to my attention. Are you just looking for a constructed query that fails?

cmay87 commented Nov 29, 2013

Looks like I managed to phase out the uses of this by manually creating complex join conditions, so here is what I could find from my notes. I seem to remember something along the lines of it also giving me trouble if I used:


instead of

->join(array('a' => $innerSelect),

Hopefully that helps a bit - it's been long enough since submitting the bug that I don't readily have better examples to give you. Let me know if there is anything else you need and I'll help out where I can.

$sql = new Sql($this->adapter);
$innerSelect = $sql->select()->from('sat_display_list_values')
), false);

//Depending on several unrelated things where conditions were added to $innerSelect

$select = $sql->select()->from($this->table)
), false)
->join(array('a' => $innerSelect),
'display_list_id = sat_display_list_id',
array('sat_display_value_text' => 'sat_display_value_text'),
->where(array('sat_field_id' => $field));

@GeeH GeeH added the To Be Closed label Mar 5, 2016

GeeH commented Jun 27, 2016

This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html

@GeeH GeeH closed this Jun 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment