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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: aceonline(at)gmx(dot)de, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16510: Count Distinct with non distinct column in combination with string constants throws error
Date: 2020-06-25 14:42:18
Message-ID: 97455ED3-B219-43BA-88EF-9CFDAF70E44E@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 25 Jun 2020, at 16:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> The reason for this might be a little more obvious if you wrote the
> implicit row constructor explicitly, ie
>
> SELECT COUNT(DISTINCT ROW(testtable.column2, 'blub')) FROM public.testtable;

That's a good point, that's a clearer explanation.

> Perhaps there's room to argue that we should allow 'unknown' to decay to
> 'text' automatically in this context, but I'm not in a big hurry to do
> that. It seems better to make people be explicit about which datatype
> they intend inside such complex, infrequently-used constructs.

Agreed, it sounds like something that will just work in most cases but run the
risk of introducing subtle bugs in the cases where it doesn't.

cheers ./daniel

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2020-06-25 14:52:42 Re: BUG #16509: Unable to change from 32 bit to 64 bit
Previous Message Tom Lane 2020-06-25 14:32:34 Re: BUG #16510: Count Distinct with non distinct column in combination with string constants throws error