#42078 [Asn->Csd]: pg_meta_data mix tables metadata from different schemas
| From: | felipe@php.net | Date: | Thu, 16 Oct 2008 00:45:57 +0000 |
| Subject: | #42078 [Asn->Csd]: pg_meta_data mix tables metadata from different schemas | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129734@lists.php.net to get a copy of this message | ||
ID: 42078
Updated by: felipe@php.net
Reported By: miksir at maker dot ru
-Status: Assigned
+Status: Closed
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: 5.2.3
Assigned To: helly
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:
------------------------------------------------------------------------
[2007-08-17 20:26:34] jani@php.net
Marcus, this ought to be simple fix. Just add an optional parameter to
pass the schema with and use that if passed..?
Bug #35996 had some sort of improved query to get the metadata.
As I don't use pgsql, I don't want to mess with the code either. :)
------------------------------------------------------------------------
[2007-07-23 11:16:21] miksir at maker dot ru
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.
Related to bug #35996 http://bugs.php.net/35996
Reproduce code:
---------------
mydb=# create schema a;
mydb=# create schema b;
mydb=# create table a.test(id int, field1 text);
mydb=# create table b.test(id int, field2 text);
In PHP connect to
mydb' with user a' (search_path will be set to
schema a) or with different user and say "set search_path = 'a';". Use
pg_meta_data('test') for get table metadata.
Expected result:
----------------
a.test metadata:
attname | attnum | typname | attlen | attnotnull | atthasdef |att...
---------+--------+---------+--------+------------+-----------+-----
id | 1 | int4 | 4 | f | f | 0
field1 | 2 | text | -1 | f | f | 0
Actual result:
--------------
mix of a.test and b.test metadata:
attname | attnum | typname | attlen | attnotnull | atthasdef |att...
---------+--------+---------+--------+------------+-----------+-----
id | 1 | int4 | 4 | f | f | 0
id | 1 | int4 | 4 | f | f | 0
field1 | 2 | text | -1 | f | f | 0
field2 | 2 | text | -1 | f | f | 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42078&edit=1