From 6291179bcc0776beffed8f013ac24708e1254757 Mon Sep 17 00:00:00 2001 From: raviks789 Date: Fri, 13 Sep 2024 18:01:39 +0200 Subject: [PATCH] DirectorDatalist: Match column types to join tables in postgres by explicit type casting --- library/Director/Objects/DirectorDatalist.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)