Re: BUG #2905: min and max return incorrect text type

From: Adriaan van Os <postgres(at)microbizz(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2905: min and max return incorrect text type
Date: 2007-01-23 19:48:29
Message-ID: 45B6668D.9000504@microbizz.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Peter Eisentraut wrote:
>>> Aside from the apparent discrepancy between the documentation and the
>>> actual behavior, is there an actual use case where this is a problem?
>
>> No, I don't think so, and I am reluctant to adjust the documentation to
>> say "or similar".
>
> The documentation is correct as it stands: max(text) returns text.
> Adriaan's complaint about max(varchar) is off base because there is
> no such function.

No, the documentation says that the Argument Type of max and min can be "any array, numeric,
string, or date/time type" and that the Return type is the "same as argument type". The functions
min and max applied to a field of type varchar return a function result of type text. So, if a
max(varchar) function is missing and the cause of the text result type is implicit type casting,
then the fact that there is no max(varchar) function is exactly the bug.

Adriaan van Os

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2007-01-23 20:04:35 Re: BUG #2905: min and max return incorrect text type
Previous Message Dave Page 2007-01-23 10:30:41 BUG #2924: pg_ctl reports 'server starting' after fatal error