Re: Bug in date arithmetic

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "David Fetter" <david(at)fetter(dot)org>,"Greg Stark" <gsstark(at)mit(dot)edu>
Cc: "PG Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Bug in date arithmetic
Date: 2009-08-24 21:13:44
Message-ID: 4A92BC38020000250002A00C@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> wrote:
> David Fetter<david(at)fetter(dot)org> wrote:
>> I'm thinking that the unknown literal here should just cause an
>> error in the case of '+'. Same with '-', for what it's worth.
>
> That would make a lot of people very unhappy. They expect things
> like
>
> select date + '1 year'
>
> to just work.

I realize I'm in a minority on this, but I would also prefer an error.
I expect things like

SELECT "date" + (INTERVAL '1' YEAR)

to just work. This whole business of taking a perfectly explicit
character string literal and treating it as an unknown literal until
something in the surrounding context causes it to automagically
resolve to any type kinda makes my skin crawl.

I'd love to have a GUC to resolve character string literals to text
when they're not in a context which makes them part of some other
standard literal declaration.

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-08-24 21:26:35 Re: 8.5 release timetable, again
Previous Message Bruce Momjian 2009-08-24 20:56:38 Re: 8.5 release timetable, again