ZF-7758: Zend_Db_Table and join = table/alias lowercased
Description
Adapter used: Pdo_Pgsql Tablename: camelCase Code:
$select = $xTable->select()
->setIntegrityCheck(false)
->from($xTable, array('action' => 'name'))
->joinInner...
Error: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "camelcase" #table is lowercased
Manual query
$select = $xTable->select()
->setIntegrityCheck(false)
->from('camelCase', array('action' => 'name'))
->joinInner...
will work as expected.
Edit: Same problem with aliasing.
->joinLeft(array('pGroups' => 'groups')... #pGroups will become pgroups
Comments
Posted by Ramon Henrique Ornelas (ramon) on 2009-10-25T17:27:11.000+0000
Not issue in ZF.
See http://framework.zend.com/manual/en/…
See http://postgresql.org/docs/8.4/…
Posted by Marek (xorock) on 2009-10-28T10:42:40.000+0000
Why it's not a ZF issue? Postgresql error code 42P01 means UNDEFINED TABLE. Table is defined as protected $_name = 'camelCase'; Query generated by ZF tries to access table which name is lowercased to "camelcase" and thus exception is thrown. As You can see this only happens when object is passed to select->from method.
Posted by Ramon Henrique Ornelas (ramon) on 2009-10-29T10:36:20.000+0000
I performed several tests.
In version 1.9.2 and in trunk no problem.
Analize the string generated Zend_Db_Table_Select.
Can help.
--query error SELECT "camelCase".* FROM camelCase; --error: SQL state: 42P01
--query error SELECT camelCase.* FROM "camelCase"; --error: SQL state: 42P01
--query success SELECT "camelCase".* FROM "camelCase";
Note quotation marks in the table.
Posted by Marek (xorock) on 2009-10-30T09:32:34.000+0000
Yes, with simple select this is ok, but try inner join.
Please ask if You need some more info.
Posted by Ramon Henrique Ornelas (ramon) on 2009-10-30T11:01:35.000+0000
your code
alter for
problem in ->joinInner('a', 'a.id = teSt.id');