Re: Issues with generate_series using integer boundaries

From: Glenn Maynard <glenn(at)zewt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Issues with generate_series using integer boundaries
Date: 2011-02-09 01:50:06
Message-ID: AANLkTik1u5qH_diMbiPU+ayJ1CfajkgCvB2Ab3Lwr+Mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Jan 31, 2011 at 7:36 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Thom Brown <thom(at)linux(dot)com> writes:
> > Actually, those lower bound errors aren't related to generate_series,
> > but I'd still like to know why -2147483648::int4 is out of range.
>
> :: binds tighter than - (and everything else too). Write
> (-2147483648)::int4 instead.
>

That's surprising enough that it might be worth generating a warning if the
typecasting operator is used on a mathmatical expression--"a -
b::int4"--rather than a single value (eg. "(a - b)::int4" or "f()::int4").
I don't know the grammar to know if that fits.

--
Glenn Maynard

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2011-02-09 02:11:22 Re: [HACKERS] Issues with generate_series using integer boundaries
Previous Message Adrian Klaver 2011-02-09 01:39:01 Re: Permission denied error - best way to fix?

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2011-02-09 01:55:05 Re: Error attribution in foreign scans
Previous Message Alex Hunsaker 2011-02-09 01:44:00 Re: arrays as pl/perl input arguments [PATCH]