mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
workaround for a Postgres bug in RefreshTable: unable to find "<" operator for type "unknown", cause by an empty string ('') in a select distinct query
This commit is contained in:
parent
6a4447b62e
commit
a1d4a47172
@ -243,23 +243,30 @@
|
||||
{
|
||||
if ($aDefaults && isset($aDefaults[$name])) // use given default
|
||||
{
|
||||
$select[] = $aDefaults[$name];
|
||||
$value = $aDefaults[$name];
|
||||
}
|
||||
elseif (isset($old_fd[$name])) // existing column, use its value => column-name in query
|
||||
{
|
||||
$select[] = $name;
|
||||
$value = $name;
|
||||
}
|
||||
else // new column => use default value or NULL
|
||||
{
|
||||
if (!isset($data['default']) && (!isset($data['nullable']) || $data['nullable']))
|
||||
{
|
||||
$select[] = 'NULL';
|
||||
$value = 'NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$select[] = $this->m_odb->quote(isset($data['default']) ? $data['default'] : '',$data['type']);
|
||||
$value = $this->m_odb->quote(isset($data['default']) ? $data['default'] : '',$data['type']);
|
||||
// fix for postgres error "no '<' operator for type 'unknown'"
|
||||
if ($this->sType == 'pgsql')
|
||||
{
|
||||
$type_translated = $this->m_oTranslator->TranslateType($data['type']);
|
||||
$value = "CAST($value AS $type_translated)";
|
||||
}
|
||||
}
|
||||
}
|
||||
$select[] = $value;
|
||||
}
|
||||
$select = implode(',',$select);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user