When using Zend_Db_Table and PDO_PGSQL I get an error in the
describeTable method of pdo_pgsql. The error comes up when a column is
a varchar because it looks for $val['length'] which does not exist.
The sql statement in that method does not select a length column. I
solved this problem by adding "a.atttypmod AS length" to the sql
statement. The complete sql is below:
$sql = "SELECT a.attnum, a.attname AS field, t.typname AS type, "
. "a.attnotnull AS isnotnull, "
. "( SELECT 't' "
. "FROM pg_index "
. "WHERE c.oid = pg_index.indrelid "
. "AND pg_index.indkey[0] = a.attnum "
. "AND pg_index.indisprimary = 't') AS pri, "
. "(SELECT pg_attrdef.adsrc "
. "FROM pg_attrdef "
. "WHERE c.oid = pg_attrdef.adrelid "
. "AND pg_attrdef.adnum=a.attnum) AS default, "
. "a.atttypmod AS length "
. "FROM pg_attribute a, pg_class c, pg_type t "
. "WHERE c.relname = '{$table}' "
. "AND a.attnum > 0 "
. "AND a.attrelid = c.oid "
. "AND a.atttypid = t.oid "
. "ORDER BY a.attnum ";
Has anybody found other issues using PDO_PGSQL?
Mark
--
Have fun or die trying - but try not to actually die.