pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Oliver Elphick <olly@lfix.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: A proposal for Interval Math
Date: Sun, 19 May 2002 14:21:05 -0700
Message-ID: <200205191421.05691.josh@agliodbs.com> (raw)
In-Reply-To: <1021841886.1401.56.camel@linda>
References: <200205191336.10383.josh@agliodbs.com>
	<1021841886.1401.56.camel@linda>


Oliver,

> As I understand the standard, this is an illegal operation, because the
> two intervals are of incompatible types and a meaningful result is not
> possible.  I do not think anyone should try to implement it.

The reason I propose it is that regardless of the standard, PostgreSQL users 
need to, for example, calculate the number of 2-week intervals in a given 
interval column all the time.   Right now, everybody is using the Date data 
type and integers, which has some significant shortcomings.  

I'm  a big proponent of standards, and you will find me on this and other 
forums pushing sticking to the standard as a #1 priority.   However, in this 
case, the standard leaves DBAs with no alternative.  SQL92 neither allows me 
to divide unlike interval units, nor to convert unlike interval units into 
like units.  Either I'm misreading it, or the ANSI committee really painted 
us into a corner on this one.

I would be quite positive to an argument that elimintates the second 
restriction but not the first, for example:
'7 months' / '3 days' = ERROR,   but
interval_round('7 months','days') / '3 days' = 70

However, I'll continue pushing for some solution that allows me to calculate 
pay periods in real intervals.

-- 
-Josh Berkus




view thread (7+ messages)  latest in thread

Message-ID: <200205191421.05691.josh@agliodbs.com>
Permalink:  ../200205191421.05691.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200205191421.05691.josh@agliodbs.com

 · 

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: josh@agliodbs.com, olly@lfix.co.uk
  Subject: Re: A proposal for Interval Math
  In-Reply-To: <200205191421.05691.josh@agliodbs.com>

* 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