Redesign sql query which should now work on postresql and mysql.
(on mssql start to work after you apply PR #13895)
Create it in a simple and in more readable way.
Testing Instructions
Install or use installed joomla staging with sample data
Go to backend component Smart Search: Indexed Content
Enable a plugin mentioned in page if disabled and create index if missing.
Go to Content Maps (on mysql it works, on postgresql you get error)
you should set up limit of displayed items to bigger number than 50 to see all items.
Open a new browser tab and apply current PR.
Go back to Content Maps:
on mysql it should still works in the same way (you can compare results with previous browser tab)
on postgresql it start working
Expected result
Page administrator/index.php?option=com_finder&view=maps works on postgresql.
Working fine on J4, but you seemed to have pushed this to the staging branch