plpgsql doesn't coerce boolean expressions to boolean

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql doesn't coerce boolean expressions to boolean
Date: 2003-09-10 13:24:59
Message-ID: 200309101524.59312.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

FWIW, I walked into this one when changing an int[ ] into a numeric(5,1)[ ] :

IF ( 0::int ) => interpreted as false

IF ( 0.0::numeric(5,1) ) => interpreted as true

Yes, there should have been used some expression that evaluated to a boolean
to begin with, but 'if (int)' is not all that uncommon ;-)

However, I expected the numeric to be coerced to integer, so the result in
itself did surprise me....

--
Best,

Frank.

Browse pgsql-general by date

  From Date Subject
Next Message Jules Alberts 2003-09-10 13:27:06 help with TCL function
Previous Message Bruno Wolff III 2003-09-10 13:08:08 Re: Constructing column from different individual fields in same row.