pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jim@nasby.net>
To: Aaron Bono <postgresql@aranya.com>
Cc: Jim Nasby <jimn@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: gdavis@refractions.net
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)
Date: Mon, 9 Oct 2006 16:54:59 -0500
Message-ID: <20061009215459.GT72517@nasby.net> (raw)
In-Reply-To: <bf05e51c0610091257m8bb5e02r9491dac16e290a2c@mail.gmail.com>
References: <4522EC42.1080500@refractions.net>
	<21619.1160067054@sss.pgh.pa.us>
	<DB91DDA2-F0F2-42CF-B5E8-A481E622F1CD@enterprisedb.com>
	<bf05e51c0610091257m8bb5e02r9491dac16e290a2c@mail.gmail.com>

On Mon, Oct 09, 2006 at 02:57:28PM -0500, Aaron Bono wrote:
> On 10/5/06, Jim Nasby <jimn@enterprisedb.com> wrote:
> >
> >On Oct 5, 2006, at 11:50 AM, Tom Lane wrote:
> >> regression=# select ('2006-09-15 23:59:00'::timestamp - '2006-09-01
> >> 09:30:41'::timestamp);
> >>      ?column?
> >> ------------------
> >>  14 days 14:28:19
> >> (1 row)
> >>
> >> should be reporting '350:28:19' instead.
> >>
> >> This is a hack that was done to minimize the changes in the regression
> >> test expected outputs when we changed type interval from months/
> >> seconds
> >> to months/days/seconds.  But I wonder whether it wasn't a dumb idea.
> >> It is certainly inconsistent, as noted in the code comments.
> >>
> >> I'm tempted to propose that we remove the justify_hours call, and tell
> >> anyone who really wants the old results to apply justify_hours() to
> >> the
> >> subtraction result for themselves.  Not sure what the fallout would
> >> be,
> >> though.
> >
> >I suspect there's applications out there that are relying on that
> >being nicely formated for display purposes.
> >
> >I agree it should be removed, but we might need a form of backwards
> >compatibility for a version or two...
> 
> I am personally of the opinion that display logic should never be put into
> the database.  Applications that rely on the database formatting - that is
> tightly coupling your application to the database which does not follow good
> programming principles.
> 
> None-the-less, the feature would be nice and may be very valuable for
> reporting.

I agree in  general, except most languages have terrible support for
time/date data, so I can see a much bigger case for the database being
able to do it (and it's not like we'll be removing justify_*). Be that
as it may, there are probably apps out there that will break if this is
just changed.
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



view thread (11+ messages)  latest in thread

Message-ID: <20061009215459.GT72517@nasby.net>
Permalink:  ../20061009215459.GT72517@nasby.net/
Also on:    postgresql.org/message-id/20061009215459.GT72517@nasby.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jim@nasby.net, postgresql@aranya.com, jimn@enterprisedb.com, tgl@sss.pgh.pa.us, gdavis@refractions.net, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)
  In-Reply-To: <20061009215459.GT72517@nasby.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox