php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35996 pg_meta_data should take the schema into account
Submitted: 2006-01-13 15:42 UTC Modified: 2008-10-16 00:46 UTC
From: G dot Gersdorf at tu-bs dot de Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-01-13 15:42 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-13 15:56 UTC] 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-21 01:00 UTC] 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".
 [2008-10-16 00:46 UTC] felipe@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:30 2024 UTC