#35996 [NoF->Csd]: pg_meta_data should take the schema into account
| From: | felipe@php.net | Date: | Thu, 16 Oct 2008 00:46:04 +0000 |
| Subject: | #35996 [NoF->Csd]: pg_meta_data should take the schema into account | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129735@lists.php.net to get a copy of this message | ||
ID: 35996
Updated by: felipe@php.net
Reported By: G dot Gersdorf at tu-bs dot de
-Status: No Feedback
+Status: Closed
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: 5.1.2
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-01-21 01:00:03] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-01-13 15:56:12] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2006-01-13 15:42:23] G dot Gersdorf at tu-bs dot de
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 this bug report at http://bugs.php.net/?id=35996&edit=1