Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] BUG #2403: Date arithemtic using INTERVAL in UPDATE command

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>,"Harry E(dot) Clarke" <Harry(dot)Clarke(at)metrosky(dot)co(dot)uk>,pgsql-bugs(at)postgresql(dot)org, Advocacy <pgsql-advocacy(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2403: Date arithemtic using INTERVAL in UPDATE command
Date: 2006-04-25 01:57:14
Message-ID: 20060425015714.GL16134@surnet.cl (view raw or flat)
Thread:
Lists: pgsql-advocacypgsql-bugs
Tom Lane wrote:

> BTW, I looked at the problem a little bit and concluded that it wouldn't
> be so invasive to fix as all that.  The weak spot at the moment is that
> parse_coerce() passes typmod -1 instead of the specified typmod to the
> datatype's input routine when converting an unknown-type literal.  It
> has to do that to get the right behavior for varchar(N) and char(N)
> ... but we could imagine hacking it to behave differently for interval.
> At the most grotty,
> 
> 	if (targetTypeId == INTERVALOID)
> 		pass targetTypeMod;
> 	else
> 		pass -1;
> 
> but maybe something cleaner could be devised.  That would take care of
> getting the info to interval_in(), and then the question is what
> interval_in() should do with it.  Your notes in the TODO entry look
> like they summarize previous discussion accurately.
> 
> It's worth pointing out that this would also affect data input, eg
> COPY into an interval column would interpret '100' differently depending
> on how the column had been declared.  I think this is OK but it'd need
> some consideration.
> 
> Actually implementing this is left as a task for someone who feels like
> hacking on the datetime code ... I don't particularly ...

I think this is a perfect project for Summer of Code.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-04-25 02:14:55
Subject: Re: [BUGS] BUG #2403: Date arithemtic using INTERVAL in UPDATE command
Previous:From: Tom LaneDate: 2006-04-25 01:04:19
Subject: Re: BUG #2403: Date arithemtic using INTERVAL in UPDATE command

pgsql-advocacy by date

Next:From: Tom LaneDate: 2006-04-25 02:14:55
Subject: Re: [BUGS] BUG #2403: Date arithemtic using INTERVAL in UPDATE command
Previous:From: Adrian KlaverDate: 2006-04-25 01:22:43
Subject: Re: Fwd: [Fest-list] speaker timeslots open

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group