DB_pgsql and schemas

From: Date: Sat, 07 Aug 2004 17:10:27 +0000
Subject: DB_pgsql and schemas
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32506@lists.php.net to get a copy of this message
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. -- og

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