|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-13 15:56 UTC] tony2001@php.net
[2006-01-21 01:00 UTC] php-bugs at lists dot php dot net
[2008-10-16 00:46 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 15:00:01 2025 UTC |
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