Issues

ZF-12554: SELECT DISTINCT in Zend_Db_Adapter_Db2::describeTable() does not work with IBM DB2 LUW 10.1

Description

 
$sql = "SELECT DISTINCT c.tabschema, c.tabname, c.colname, c.colno,
                c.typename, c.default, c.nulls, c.length, c.scale,
                c.identity, tc.type AS tabconsttype, k.colseq
                FROM syscat.columns c
                LEFT JOIN (syscat.keycoluse k JOIN syscat.tabconst tc
                ON (k.tabschema = tc.tabschema
                    AND k.tabname = tc.tabname
                    AND tc.type = 'P'))
                ON (c.tabschema = k.tabschema
                    AND c.tabname = k.tabname
                    AND c.colname = k.colname)
                WHERE "
                . $this->quoteInto('UPPER(c.tabname) = UPPER(?)', $tableName);

The datatype for column DEFAULT changed from VARCHAR to CLOB in internal table SYSCAT.COLUMNS. A SELECT DISTINCT query is not allowed on following datatypes: CLOB, DBCLOB, BLOB, LONG VARCHAR or LONG VARGRAPHIC. See error SQL0134N.

To reproduce it you need IBM DB2 LUW 10.1 Database server and the following code:

$adapter = new Zend_Db_Adapter_Db2(
        array(
            'host'             => '127.0.0.1',
            'username'         => 'webuser',
            'password'         => 'xxxxxxxx',
            'dbname'           => 'test'
        )
    );
$adapter->describeTable('TABLE', 'SCHEMA');

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf1/issues/70