diff --git a/phpgwapi/inc/class.schema_proc_pgsql.inc.php b/phpgwapi/inc/class.schema_proc_pgsql.inc.php index 0f83154b60..ce73f8b7a1 100644 --- a/phpgwapi/inc/class.schema_proc_pgsql.inc.php +++ b/phpgwapi/inc/class.schema_proc_pgsql.inc.php @@ -392,8 +392,14 @@ $sSQL .= ','; } - if($oProc->m_odb->f($name) != null) + // !isset($arraydef['nullable']) means nullable !!! + if($oProc->m_odb->f($name) == NULL && (!isset($arraydef['nullable']) || $arraydef['nullable'])) { + $sSQL .= 'NULL'; + } + else + { + $value = $oProc->m_odb->f($name) != NULL ? $oProc->m_odb->f($name) : @$arraydef['default']; switch($arraydef['type']) { case 'blob': @@ -408,17 +414,6 @@ $sSQL .= (int)$oProc->m_odb->f($name); } } - else - { - if(isset($arraydef['nullable']) && $arraydef['nullable']) - { - $sSQL .= 'null'; - } - else - { - $sSQL .= "''"; - } - } $i++; } $sSQL .= ')';