> On 25 Jun 2020, at 15:02, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
> SELECT
> COUNT( DISTINCT (testtable.column2, 'blub') )
> FROM
> public.testtable;
PostgreSQL doesn't know which datatype you expect 'blub' to be, as it isn't
related to the testtable relation in your query. If you cast to the datatype
of your choice you will get the expected result.
postgres=# SELECT COUNT(DISTINCT(testtable.column2, 'blub')) FROM public.testtable;
ERROR: could not identify a comparison function for type unknown
postgres=# SELECT COUNT(DISTINCT(testtable.column2, 'blub'::varchar)) FROM public.testtable;
count
-------
1
(1 row)
cheers ./daniel