Re: problem using Dataobject generator with postgresql and multiple schemas

From: Date: Thu, 10 Mar 2005 15:18:34 +0000
Subject: Re: problem using Dataobject generator with postgresql and multiple schemas
References: 1  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-36637@lists.php.net to get a copy of this message
Jeroen Houben wrote:
Hi, I'm trying to generate dataobjects for a pg database (7.4) using schemas. I'm using the latest stable dataobject and PHP 5.0.2 and I get the following error:
DB_DataObject_Generator   : 0       : CREATING FOR terena
[db_error: message="DB Error: insufficient data supplied" code=-20 mode=return level=notice prefix="" info="SELECT c.relname AS "Name" FROM pg_class c, pg_user u WHERE c.relowner = u.usesysid AND c.relkind = 'r' AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) AND c.relname !~ '^(pg_|sql_)' UNION SELECT c.relname AS "Name" FROM pg_class c WHERE c.relkind = 'r' AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) AND c.relname !~ '^pg_' [nativecode=ERROR: relation "area_events" does not exist]"] The full table name would be "terena.event.area_events" Any ideas?
Some further investigation led me to believe that the table list fetched by PEAR::DB still doesn't return the schema along with the table name (http://pear.php.net/bugs/bug.php?id=682) even though support for this was addded a while ago in version 1.7 If I echo the table names by adding a small echo statement in Generator.php I see all tablenames in my database, but all without the schemaname prepended.. So changed a line in Generator.php
       $this->tables = $__DB->getListOf('tables');
becomes:
       $this->tables = $__DB->getListOf('schema.tables');
Now my classes get generated okay, but the schema name gets prepended:
DB_DataObject_Generator   : 0       : writing News_area_news
DB_DataObject_Generator   : 0       : writing News_topic_news
... etc. That's small thing though. Any chance this "patch" will make it into a stable version, perhaps as an option? Should I file a feature request? Thanks, Jeroen

« previous php.pear.dev (#36637) next »