ZF-7640: Zend_Db_Adapter_Pdo_Pgsql::describeTable() returns length -1 for fields of the type character

Issue Type: Patch Created: 2009-08-19T15:27:49.000+0000 Last Updated: 2009-12-18T09:31:51.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Ramon Henrique Ornelas (ramon) Assignee: Mickael Perraud (mikaelkael) Tags: - Zend_Db

Related issues: Attachments: - Pgsql.php.patch


problem length field of the type character in Adapter_Pdo_Pgsql.

length returned -1, with the call of the method describeTable

solution, the modified Adapter_Pdo_Pgsql


<pre class="highlight">
if ($row[$type] == 'varchar' || $row[$type] == 'bpchar' ) {
                if (preg_match('/character(?: varying)?(?:\((\d+)\))?/', $row[$complete_type], $matches)) {
                    if (isset($matches[1])) {
                        $row[$length] = $matches[1];
                    } else {
                        $row[$length] = null; // unlimited


Posted by Ramon Henrique Ornelas (ramon) on 2009-10-27T12:05:22.000+0000

Return length character type and default value.

Posted by Ramon Henrique Ornelas (ramon) on 2009-10-27T12:09:37.000+0000

Look patch.

Posted by Mickael Perraud (mikaelkael) on 2009-12-18T09:31:50.000+0000

Patch applied and test added with r19751

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.