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

Issue Type: Bug Created: 2013-03-27T11:19:53.000+0000 Last Updated: 2013-04-05T16:05:08.000+0000 Status: Closed Fix version(s): Reporter: Burak YĆ¼ksel (byk58) Assignee: None Tags: - Zend_Db_Adapter_Db2

  • zend-db

Related issues: Attachments:


<pre class="literal"> 
$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:

<pre class="literal">
$adapter = new Zend_Db_Adapter_Db2(
            'host'             => '',
            'username'         => 'webuser',
            'password'         => 'xxxxxxxx',
            'dbname'           => 'test'
$adapter->describeTable('TABLE', 'SCHEMA');


Posted by Ralph Schindler (ralph) on 2013-04-05T16:05:08.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.