cvs: pear /MDB2/MDB2/Driver/Manager pgsql.php

[email protected] ("Lorenzo Alberton")
Newsgroups php.pear.cvs
Message-ID <cvsquipo1210688585@cvsserver>
quipo		Tue May 13 14:23:05 2008 UTC

  Modified files:              
    /pear/MDB2/MDB2/Driver/Manager	pgsql.php 
  Log:
  fixed bug #13877 in listTableConstraints(): UNIQUE index not always recognized as constraint
  
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Manager/pgsql.php?r1=1.82&r2=1.83&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/pgsql.php
diff -u pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.82 pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.83
--- pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.82	Wed Mar  5 12:55:57 2008
+++ pear/MDB2/MDB2/Driver/Manager/pgsql.php	Tue May 13 14:23:04 2008
@@ -42,7 +42,7 @@
 // | Author: Paul Cooper <[email protected]>                                 |
 // +----------------------------------------------------------------------+
 //
-// $Id: pgsql.php,v 1.82 2008/03/05 12:55:57 afz Exp $
+// $Id: pgsql.php,v 1.83 2008/05/13 14:23:04 quipo Exp $
 
 require_once 'MDB2/Driver/Manager/Common.php';
 
@@ -758,7 +758,16 @@
         $query = 'SELECT conname
                     FROM pg_constraint, pg_class
                    WHERE pg_constraint.conrelid = pg_class.oid
-                     AND relname = ' .$table;
+                     AND relname = '.$table.'
+                UNION DISTINCT
+                  SELECT relname
+                    FROM pg_class
+                   WHERE oid IN (
+                         SELECT indexrelid
+                           FROM pg_index, pg_class
+                          WHERE pg_class.relname = '.$table.'
+                            AND pg_class.oid = pg_index.indrelid
+                            AND indisunique = \'t\')';
         $constraints = $db->queryCol($query);
         if (PEAR::isError($constraints)) {
             return $constraints;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.