Skip site navigation (1) Skip section navigation (2)

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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Adriaan van Os <postgres(at)microbizz(dot)nl>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2905: min and max return incorrect text type
Date: 2007-01-23 23:02:58
Message-ID: 200701232302.l0NN2wl27035@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Alvaro Herrera wrote:
> Adriaan van Os wrote:
> > 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.
> 
> Do you have a specific situation on which this causes a problem for you?
> I mean, are you asking because it really bugs you, or just for the sake
> of being pedantic?  

And what suggestion do you have for a change?  How would you like the
documentation wording changed?

-- 
  Bruce Momjian   bruce(at)momjian(dot)us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2007-01-24 02:09:52
Subject: Re: BUG #2895: Private Use Unicode character crashes server when using ILIKE
Previous:From: Alvaro HerreraDate: 2007-01-23 20:04:35
Subject: Re: BUG #2905: min and max return incorrect text type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group