From: | Ian Barwick <barwick(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Boolean casting in 7.3 -> changed? |
Date: | 2002-11-27 07:21:29 |
Message-ID: | 200211270821.29513.barwick@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday 27 November 2002 06:23, Tom Lane wrote:
> Ian Barwick <barwick(at)gmx(dot)net> writes:
> > in 7.3 the following no longer works:
> > template1=> select 0::bool;
> > ERROR: Cannot cast type integer to boolean
>
> Note that both old and new versions reject
> select 0::int4::bool;
>
> I believe the behavioral change is a consequence of Rod Taylor's
> DOMAIN patch: it essentially eliminated the old parser_typecast_constant()
> routine in order to ensure that constraints associated with a domain
> would get applied in examples like "select 0::domaintypename".
>
> I wasn't totally happy with Rod's patch, for reasons that I couldn't put
> my finger on at the time, but perhaps my hindbrain understood that there
> would be noticeable behavioral changes. But be that as it may, the code
> is in there now and is unlikely to get reverted. There isn't any place
> in our docs that promises that you can coerce an integer-looking literal
> to bool --- and one could argue that allowing such is just opening the
> door for typos.
Thanks for the explanation. I'm not screaming for a reversion ;-), but
changing behaviour which was implicitly valid in previous
versions is bound to cause a few people a little head scratching
when converting applications to 7.3 (I'm sure I can't be the only one).
How about a line in HISTORY under "Migration to version 7.3" along
the lines of:
"Casting integers to boolean (for example, 0::bool) is no longer allowed,
use '0'::bool instead".
Ian Barwick
barwick(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Al Sutton | 2002-11-27 08:21:51 | Re: [mail] Re: Native Win32 sources |
Previous Message | Shridhar Daithankar | 2002-11-27 06:59:21 | Re: Auto Vacuum Daemon (again...) |