#35996 [NEW]: pg_meta_data should take the schema into account
| From: | G dot Gersdorf at tu-bs dot de | Date: | Fri, 13 Jan 2006 14:42:23 +0000 |
| Subject: | #35996 [NEW]: pg_meta_data should take the schema into account | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-91849@lists.php.net to get a copy of this message | ||
From: G dot Gersdorf at tu-bs dot de
Operating system: Linux
PHP version: 5.1.2
PHP Bug Type: PostgreSQL related
Bug description: pg_meta_data should take the schema into account
Description:
------------
If a database contains tables with the same name in different schemas,
requesting the meta data for this table returns a mix for all fields in
all that tables.
The select statement use is something like
SELECT a.attname, a.attnum, t.typname, a.attlen,
a.attnotNULL, a.atthasdef, a.attndims
FROM pg_class as c, pg_attribute a, pg_type t
WHERE a.attnum > 0 AND a.attrelid = c.oid AND
c.relname='$table' AND a.atttypid = t.oid
ORDER BY a.attnum
but should be something like
SELECT a.attname, a.attnum, t.typname, a.attlen,
a.attnotNULL, a.atthasdef, a.attndims
FROM pg_class as c, pg_attribute a, pg_type t,
pg_namespace n
WHERE a.attnum > 0 AND a.attrelid = c.oid AND
c.relname='$table' AND a.atttypid = t.oid
AND c.relnamespace=n.oid AND n.nspname='$schema'
ORDER BY a.attnum
where $schema='public' as default
--
Edit bug report at http://bugs.php.net/?id=35996&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35996&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35996&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35996&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35996&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35996&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35996&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35996&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35996&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35996&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35996&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35996&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35996&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35996&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35996&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35996&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35996&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35996&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35996&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35996&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35996&r=mysqlcfg