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

Bug #16384 alterTable() does not remove NOT NULL constraints
Submitted: 2009-06-27 19:22 UTC Modified: 2009-06-27 19:34 UTC
From: hschletz Assigned: quipo
Status: Closed Package: MDB2_Driver_pgsql (version 1.5.0b2)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  



Patch fix_remove_notnull_constraint Revisions
Revision 2009-06-27 19:23 UTC
Developer hschletz
 
Download patch

--- MDB2/Driver/Manager/pgsql.php.orig	2009-01-14 17:39:15.000000000 +0100
+++ MDB2/Driver/Manager/pgsql.php	2009-06-27 19:43:45.855957203 +0200
@@ -409,7 +409,7 @@
                         return $result;
                     }
                 }
-                if (!empty($field['definition']['notnull'])) {
+                if (array_key_exists('notnull', $field['definition'])) {
                     $query = "ALTER $field_name ".($field['definition']['notnull'] ? 'SET' : 'DROP').' NOT NULL';
                     $result = $db->exec("ALTER TABLE $name $query");
                     if (PEAR::isError($result)) {