Merge "Fix ORMRow::insert() on PostgreSQL."
[lhc/web/wiklou.git] / includes / db / ORMRow.php
index 7fb7ae1..6c1f27f 100644 (file)
@@ -261,6 +261,11 @@ class ORMRow implements IORMRow {
                        if ( array_key_exists( $name, $this->fields ) ) {
                                $value = $this->fields[$name];
 
+                               // Skip null id fields so that the DBMS can set the default.
+                               if ( $name === 'id' && is_null ( $value ) ) {
+                                       continue;
+                               }
+
                                switch ( $type ) {
                                        case 'array':
                                                $value = (array)$value;