On Mon, 11 Oct 2004, Tom Lane wrote:
> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> > On Mon, 11 Oct 2004, Sean Chittenden wrote:
> >> I would posit that this is the desired behavior as it's consistent with
> >> every language I can think of.
> > However, AFAIK it's inconsitent with the type input function which
> > supports '1' and '0' but not other integers.
> The question for an integer-to-bool conversion is what is useful and
> expected behavior for that conversion; I don't think that's necessarily
> the same as what the textual conversion should do.
> A possibly useful analogy is that real-to-integer coercion rounds off
> fractions; it doesn't error out, even though the integer input function
> won't take a string that includes a decimal point.
Well, technically AFAICS, a string to integer conversion has to follow the
same general rules as numeric to integer by SQL99. So a varchar value of
'2.5' cast to int should work and give you the same value as 2.5 cast to
int (or at least, I can't see any other way to read 6.22GR6b). But since
we do odd things with quoted literals, it makes the case anyway and I
withdraw the comment.
In response to
pgsql-patches by date
|Next:||From: Peter Eisentraut||Date: 2004-10-12 07:05:19|
|Subject: Re: Casting INT4 to BOOL...|
|Previous:||From: Neil Conway||Date: 2004-10-12 04:48:49|
|Subject: Re: fix vpath build break|