When inserting a new row, ORMRow explicitly passed NULL as the value for
the id field which in MySQL means "use next value in sequence", but in
PostgreSQL means "use NULL". With this change, for id fields no value
is passed if it isn't set to non-null. This fixes bug #43475.
This effectively bars the possibility to set the id field of an existing
row to NULL, but the current code already disallows any changes in id
fields.
Change-Id: I29d86fa6fc38ff1852821658e4927b4d7d4a72b6
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;