Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-19 Thread Tom Lane
"Dawid Kuroczko" <[EMAIL PROTECTED]> writes: > ... Now, assuming UNIQUE INDEX on such table, the order would be preserved > since no two intervals can overlap. And no overlapping data could be inserted > without breaking "ovelapivity". And of course non-unique index would > produce garbage (since

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-19 Thread Ian Caulfield
On 17/02/07, Warren Turkal <[EMAIL PROTECTED]> wrote: PERIOD(INT) is actually listed in the Dr. Snodgrass's book. However, I am not really sure about the semantics of the type. When would you use a PERIOD(INT)? It wouldn't be directly useful for temporal SQL, but I have a number of tables in a

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-19 Thread Dawid Kuroczko
On 2/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: Hannu Krosing <[EMAIL PROTECTED]> writes: > How easy/hard would it be to create unique indexes on tinterval (unique > here meaning non-overlapping) ? "Overlapping" is not an equality relation (it fails the transitive law), so I'm not entirely sure

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-18 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Well, unique is usually defined as "not equal to any other". And "not > equal" also fails transitive law [...] > But it should be trivial to test at insertion time if the interval > overlaps with any existing intervals [...] Putting your point anot

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-18 Thread Martijn van Oosterhout
On Sun, Feb 18, 2007 at 08:14:00PM +0200, Hannu Krosing wrote: > > but I can promise you you can't make it work with btree. > > Sorry to hear that. btree seemed like the best candidate for doing it. The problem with btree is that it's designed to work with a compare function which compares two da

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-18 Thread Hannu Krosing
Ühel kenal päeval, L, 2007-02-17 kell 11:26, kirjutas Tom Lane: > Hannu Krosing <[EMAIL PROTECTED]> writes: > > How easy/hard would it be to create unique indexes on tinterval (unique > > here meaning non-overlapping) ? > > "Overlapping" is not an equality relation (it fails the transitive law), >

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-17 Thread Martijn van Oosterhout
On Sat, Feb 17, 2007 at 11:40:44AM -0700, Warren Turkal wrote: > On Saturday 17 February 2007 09:26, Tom Lane wrote: > > "Overlapping" is not an equality relation (it fails the transitive law), > > so I'm not entirely sure what "unique" means in this context ... but I > > can promise you you can't

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-17 Thread Warren Turkal
On Saturday 17 February 2007 09:26, Tom Lane wrote: > "Overlapping" is not an equality relation (it fails the transitive law), > so I'm not entirely sure what "unique" means in this context ... but I > can promise you you can't make it work with btree. There is an equality relation on periods. But

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-17 Thread Warren Turkal
On Saturday 17 February 2007 01:50, Hannu Krosing wrote: > Is tinterval meant to be open/closed at start and end ? I don't see the tinterval doing anything other than storing two times. wt -- Warren Turkal (w00t) ---(end of broadcast)--- TIP 9: In

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-17 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: > How easy/hard would it be to create unique indexes on tinterval (unique > here meaning non-overlapping) ? "Overlapping" is not an equality relation (it fails the transitive law), so I'm not entirely sure what "unique" means in this context ... but I can

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-17 Thread Hannu Krosing
Ühel kenal päeval, R, 2007-02-16 kell 17:39, kirjutas Alvaro Herrera: > Jim C. Nasby wrote: > > My suggestion would be to focus on a period data type first and > > foremost, as that's something that could be readily used by a lot of > > folks. Of particular note, it's difficult to query tables that

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-16 Thread Oleg Bartunov
On Fri, 16 Feb 2007, Alvaro Herrera wrote: Jim C. Nasby wrote: My suggestion would be to focus on a period data type first and foremost, as that's something that could be readily used by a lot of folks. Of particular note, it's difficult to query tables that have start_time and end_time fields

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-16 Thread Warren Turkal
On Fri, Feb 16, 2007 at 05:39:24PM -0300, Alvaro Herrera wrote: > FWIW there's already a type called tinterval that stores (start,end). I > don't think it's very much documented; maybe it can be extended or used > as base for a new, more complete and robust type, indexable in a more > natural way,

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-16 Thread Alvaro Herrera
Jim C. Nasby wrote: > My suggestion would be to focus on a period data type first and > foremost, as that's something that could be readily used by a lot of > folks. Of particular note, it's difficult to query tables that have > start_time and end_time fields to define a period; it's easy to screw

Re: [HACKERS] RFC: Temporal Extensions for PostgreSQL

2007-02-16 Thread Jim C. Nasby
My suggestion would be to focus on a period data type first and foremost, as that's something that could be readily used by a lot of folks. Of particular note, it's difficult to query tables that have start_time and end_time fields to define a period; it's easy to screw up the boundary conditions,