ZF-5169: QSYS2.SYSCOLUMNS not limiting search by SCHEMA in Zend_Db_Adapter_Db2::describeTable()

Issue Type: Bug Created: 2008-12-05T15:18:16.000+0000 Last Updated: 2009-05-10T19:41:06.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Simon Verberne (zedmond) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Adapter_Db2

Related issues: Attachments:


The $schemaName variable passed to Zend_Db_Adapter_Db2::describeTable() is not being set to the schema name defined in the default adapter. This is causing the function to scan the entire QSYS2 table when it should only be looking for matches for the schema named in the adapter. Our QSYS2 table contains over 1,000,000 records. This causes a tremendous slowdown since the table is scanned once for each query; some screens querying over a dozen tables.

A check is performed in the describeTable() method to see if $schemaName is set. In every case it is not. The adapter has a variable which is set containing the schema name ($this->_config['schema']). I modified my version of the adapter to check for $this->_config['schema'] rather than the passed $schemaName variable and use its value and it's now running much faster.

I did notice that if I explicitly set the schema name for a given model the queries work as expected (i.e. the query only checks the schema indicated). Must this be done? It seems to defeat the purpose of setting the schema in the adapter to have set it again for each model; all of which use the same adapter. Shouldn't the adapter pass the schema name on if it's not set in the model?

Please forgive me if this post is a duplicate.

I am running a copy of the DB2 adapter found here:…

You will find information about my system settings in the following thread: ZF-4501


Posted by old of Satoru Yoshida ( on 2008-12-08T05:48:16.000+0000

Hi, Simon.

Do you mean that the schema name must be required in __construct() of Zend_Db_Adapter_Db2 ?

Posted by Simon Verberne (zedmond) on 2008-12-08T06:07:26.000+0000

I'm not sure if the schema name should be required in the constructor. I would think that it would not be required. The issue we are having is that the schema name IS set in the constructor but is not being passed to the describeTable() method in the adapter (it's an optional second parameter).

It seems to me that if the schema name is set in the constructor it should be passed into this function by default. This is currently not the case for me.

Posted by Ralph Schindler (ralph) on 2008-12-08T09:22:50.000+0000

This is on my radar, I am getting our i5 instance repartitioned at the moment, so once thats going I am gonna work on persisting the _schema in the i5 describeTable() method.

Posted by old of Satoru Yoshida ( on 2008-12-09T05:07:35.000+0000

Hi, Simon and Ralph.

I have an idea as following skelton.

<pre class="highlight">
protected $_schema;

public function __construct($config){
        $this->_schema = $config['schema'];

public function describeTable($tableName, $schemaName = $this->_schema){

If You give schema on __construct, You can use as default value.

Posted by Ralph Schindler (ralph) on 2009-01-11T21:58:22.000+0000

is this still an issue in the adapter in 1.7.2?

Posted by old of Satoru Yoshida ( on 2009-05-10T19:41:03.000+0000

I confirm today that this issue have been fixed at 1.7.2 .

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.