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

Bug #6476 Behaviour of MySQL and PostgreSQL drivers differ
Submitted: 2006-01-12 07:42 UTC Modified: 2006-01-13 11:45 UTC
From: wiesemann Assigned: wiesemann
Status: Closed Package: MDB2_Driver_pgsql
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2006-01-12 07:42 UTC] wiesemann
Description: ------------ Behaviour of MySQL and PostgreSQL drivers differ (in manager classes): MySQL (expected behaviour): - listTableIndexes() returns only 'INDEX' indexes - listTableConstraints() returns 'PRIMARY' and 'UNIQUE' indexes PostgreSQL (having 1 primary and 3 three unique indexes): - listTableIndexes() returns nothing - listTableConstraints() returns nothing (unexpected) After removing "AND indisunique != 't'" from line 507 in listTableIndexes() it returns the three unique indexes.

Comments

 [2006-01-12 11:03 UTC] lsmith
What do you get when you run the test suite with pgsql? It seems to return indexes and unique indexes just fine for me.
 [2006-01-12 14:58 UTC] wiesemann
The tests run just fine: mdb2_manager_testcase : Starting testlistindexes ... Test passed [...] mdb2_manager_testcase : Starting testlistconstraints ... Test passed But listTableConstraints() (or even the query used there, I've tried it with pgAdmin III) returns actually only the primary key, not the three unique indexes. Removing "AND indisunique != 't' AND indisprimary != 't'" from the query used in listTableIndexes() gives the expected result (all 4 index names).
 [2006-01-12 15:22 UTC] lsmith
but unique indexes are not supposed to show up in listTableIndexes() .. they are only supposed to show in listTableConstaints()
 [2006-01-12 15:25 UTC] wiesemann
Yes, true. What I wanted to say: Using the modified query from listTableIndexes() in listTableContraints() would end up in the right result (hopefully also for other cases).
 [2006-01-12 16:37 UTC] lsmith
But the test for listTableConstraints() tests with a unique index. This is what is puzzeling me with your report. Anyways could you send me your DDL for the table you are testing on. Best would be a self containing test script of course. Thx for working through this stuff. I do not intend to sound rude or anything. Unfortunately this stuff is needlessly tricky and so I just have to understand the entire picture and all side effects. Also what version are you using for testing of PostGreSQL?
 [2006-01-13 05:22 UTC] lsmith
Ah I think I am finally onto the problem. The issue is that pgsql separates unique indexes and unique constraints. MDB2 creates unique constraints and not unique indexes which explains why the test suite runs through just fine. I presume you however created unique indexes?
 [2006-01-13 05:42 UTC] lsmith
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2006-01-13 11:45 UTC] wiesemann
Just as a remark: The problem is solved, I get now the desired result. Your assumptions were right (cp. #6475).