Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #13281 listTableConstraints doesn't return FKs in pgsql
Submitted: 2008-03-01 20:00 UTC Modified: 2008-03-02 10:39 UTC
From: arestivo Assigned: quipo
Status: Closed Package: MDB2 (version 2.4.1)
PHP Version: 5.2.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-03-01 20:00 UTC] arestivo (André Restivo)
Description: ------------ The listTableConstraints method in the Manager module isn't returning FK's. Looking into the code it seems that the query being isn't the ideal. I would use something like: SELECT conname FROM pg_constraint, pg_class WHERE pg_constraint.conrelid = pg_class.oid AND relname = $table A similar problem seems to be happening in the getTableConstraintDefinition method in the Reverse module. I tried to get a FK definition and MDB2 reports that the FK doesn't exist. Sorry if this bug is already known or if this is the expected behavior.

Comments

 [2008-03-02 03:23 UTC] quipo (Lorenzo Alberton)
Support for FK constraints was added in MDB2 2.5.0a1. Please upgrade the package: $ pear upgrade MDB2-alpha
 [2008-03-02 06:57 UTC] arestivo (André Restivo)
I installed 2.5.0a2 and it still doesn't work. The code seems pretty much the same for the pgsql Manager module (at least in the constraints section).
 [2008-03-02 07:05 UTC] arestivo (André Restivo)
However the getTableConstraintDefinition in the Reverse module seems to be working fine in 2.5.0a2. I managed to get FK discovery working with pgsql by using 2.5.0a2 and changing the code in listTableConstraints from: $query = "..."; to $query = "SELECT conname FROM pg_constraint, pg_class WHERE pg_constraint.conrelid = pg_class.oid AND relname = $table";
 [2008-03-02 10:39 UTC] quipo (Lorenzo Alberton)
You're right, the query wasn't updated. Fixed in CVS.