Re: DB_pgsql and schemas

From: Date: Sat, 07 Aug 2004 21:59:05 +0000
Subject: Re: DB_pgsql and schemas
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32509@lists.php.net to get a copy of this message
Justin Patrin wrote:
On Sat, 07 Aug 2004 19:10:27 +0200, Olivier Guilyardi <ml@xung.org> wrote:
Hi, At first I tried to use the DataObject Auto Builder against my postgresql database : it failed complaining about some non-existent relation. My database uses schemas and the error shortly describe above was coming from the DB::getListOf('tables') call performed by DataObject_Generator. Briefly, it was trying to get informations about table 'bar' while this belongs to the 'foo' schema, and thus can only be accessed with 'foo.bar', if no schema search path is set up (my case). Attached to this mail is a patch against DB 1.6.5 that fixes DB/pgsql.php for this issue : it modifies the getSpecialQuery() method, so that it returns a query that fetches fully qualified table names (as 'schema.table'). For those tables whose schema is 'public' (the default schema), the table names are retrieved without any schema prefix. Using this modified DB_pgsql class, Dataobject_Generator ran smoothly and created the dozen or so objects needed for my database. It's not thoroughly tested though, it works for me and my 7.4.2 Postgresql server. Additionally, the patch does not address this issue for functions and views, which belong to a schema as well.
You should submit this as a bug report: http://pear.php.net/bugs/search.php?direction=ASC&cmd=display&status=Open&package_name[0]=DB
I'm first going to try improving that patch, so that it gets compatible with postgresql versions prior to 7.3, which introduced the schema implementation. I just realized it breaks on 7.2 -- og

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