Re: Casting on the limit

From: Ottó Havasvölgyi <havasvolgyi(dot)otto(at)gmail(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Casting on the limit
Date: 2008-01-21 11:08:42
Message-ID: 34608c0c0801210308g1e4583baiee415029d98f12b7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you:) I didn't even thought of this case. I am a bit surprised
that "::" has higher precedence than negation, but maybe it has some
cause.
Sorry for sending it to this list.

Best regards,
Otto

2008/1/21, Heikki Linnakangas <heikki(at)enterprisedb(dot)com>:
> Ottó Havasvölgyi wrote:
> > In 8.2.5:
> >
> > This does not work (out of range):
> > select -32768::int2
> >
> > But this works:
> > select cast(-32768 as int2);
> >
> > What is the difference between the two syntax in the background? I
> > always thought they are the same.
>
> "select -32768::int2" is equal to "select -(32768::int2)", and 32768
> doesn't fit in an int2.
>
> --
> Heikki Linnakangas
> EnterpriseDB http://www.enterprisedb.com
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira de Oliveira 2008-01-21 12:35:11 Re: BUG #3891: Multiple UPDATE doesn't handle UNIQUE constraint correctly
Previous Message Heikki Linnakangas 2008-01-21 09:42:19 Re: Casting on the limit