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-02 01:00 UTC
From: arestivo Assigned: quipo
Status: Closed Package: MDB2 (version 2.4.1)
PHP Version: 5.2.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 30 - 4 = ?

 
 [2008-03-02 01: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 08: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 11: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 12: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 15:39 UTC] quipo (Lorenzo Alberton)
You're right, the query wasn't updated. Fixed in CVS.