Re: Bug and/or feature? Complex data types in tables...

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: Chris Travers <chris(at)travelamericas(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Bug and/or feature? Complex data types in tables...
Date: 2004-01-15 13:31:21
Message-ID: 20040115133120.GA8382@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Jan 15, 2004 at 08:29:41PM +0900, Michael Glaesemann wrote:

> >Is there a problem with the built in definitions of point and interval?
>
> I'm thinking along the lines of the temporal proposals Date, Darwen,
> and Lorentzos ("Temporal Data and the Relational Model"). Their
> "interval" type is more along the lines of a beginning and end time,
> such as ['2003-1-23':'2003-1-25'], rather than just '2 days'.

Maybe it's tangential to this discussion, but there's a type to store
that kind of intervals. It's called tinterval. ISTM it's not too much
documented, and I haven't really used it.

alvherre=> select tinterval('2003-10-28', '2004-11-05');
tinterval
-----------------------------------------------------
["2003-10-28 00:00:00-03" "2004-11-05 00:00:00-03"]
(1 fila)

alvherre=> select tinterval('2003-10-28', '2004-11-05') && tinterval('2003-10-05', '2003-10-15');
?column?
----------
f
(1 fila)

alvherre=> select tinterval('2003-10-28', '2004-11-05') && tinterval('2003-10-05', '2003-11-15');
?column?
----------
t
(1 fila)

(There are other operators, of course ...)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Criptografía: Poderosa técnica algorítmica de codificación que es
empleada en la creación de manuales de computadores.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Garamond 2004-01-15 14:17:45 YAGT (yet another GUID thread)
Previous Message Nick Barr 2004-01-15 12:22:32 Re: Using regular expressions in LIKE

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2004-01-15 14:32:00 Re: [pgsql-hackers-win32] Win32 signal code - first try
Previous Message Pavel Stehule 2004-01-15 13:19:50 client_encoding in dump file