diff --git a/library/Director/Objects/DirectorDatalist.php b/library/Director/Objects/DirectorDatalist.php index b9b3ac336..637bc75a5 100644 --- a/library/Director/Objects/DirectorDatalist.php +++ b/library/Director/Objects/DirectorDatalist.php @@ -94,6 +94,12 @@ protected function isInUse(): bool $db = $this->getDb(); + if ($this->getConnection()->getDbType() === 'pgsql') { + $datalistJoin = 'l.id = CAST(dfs.setting_value AS INTEGER)'; + } else { + $datalistJoin = 'l.id = dfs.setting_value'; + } + $dataFieldsCheck = $db->select() ->from(['df' => 'director_datafield'], ['varname']) ->join( @@ -103,7 +109,7 @@ protected function isInUse(): bool ) ->join( ['l' => 'director_datalist'], - 'l.id = dfs.setting_value', + $datalistJoin, [] ) ->where('datatype = ?', DataTypeDatalist::class)