#42078 [Opn->Asn]: pg_meta_data mix tables metadata from different schemas
| From: | jani@php.net | Date: | Fri, 17 Aug 2007 20:26:41 +0000 |
| Subject: | #42078 [Opn->Asn]: pg_meta_data mix tables metadata from different schemas | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116268@lists.php.net to get a copy of this message | ||
ID: 42078
Updated by: jani@php.net
Reported By: miksir at maker dot ru
-Status: Open
+Status: Assigned
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: 5.2.3
-Assigned To:
+Assigned To: helly
New Comment:
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. :)
Previous Comments:
------------------------------------------------------------------------
[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