Re: BUG #16510: Count Distinct with non distinct column incombination with string constants throws error

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: BUG #16510: Count Distinct with non distinct column incombination with string constants throws error
Дата
Msg-id 5CF2CF6C-8951-4CA1-980C-94F369B7EE86@yesql.se
обсуждение исходный текст
Ответ на BUG #16510: Count Distinct with non distinct column in combination with string constants throws error  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #16510: Count Distinct with non distinct column in combination with string constants throws error  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
> On 25 Jun 2020, at 15:02, PG Bug reporting form <noreply@postgresql.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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Axel Zellner
Дата:
Сообщение: Bug: Postgresql with Postgis: Different result in coordinateconversion NAV4 <=> WGS84 in Linux and Windows
Следующее
От: Pierre Mantha
Дата:
Сообщение: Re: BUG #16509: Unable to change from 32 bit to 64 bit