Periods

From: Vik Fearing <vik(dot)fearing(at)protonmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Periods
Date: 2018-05-26 20:56:15
Message-ID: mSRBIYry-zk13wGeWVYCGw5o0LqZ4dyectlawH43VoLzQ70Tqa2oClVdkmQ1MlhG2lToRBkyY77g1o7vSGUwMS9BXvE-H-bg_x9bjx0DKNI=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

SQL:2011 introduced the concept of a "period". It takes two existing columns and basically does the same thing as our range types except there is no new storage. I believe if Jeff Davis had given us range types a few years later than he did, it would have been using periods.

Attached is a WIP patch that I have been working on. The only thing left is completing periods on inherited tables, and finishing up pg_dump. I'm posting this now just to make sure my basic foundation is sound, and to let people know that I'm working on this.

The patch itself doesn't have any functionality, it just allows periods to be defined. With that, there are several things that we can do: SYSTEM_TIME periods, which are explicitly not allowed by this patch, will allow us to do SQL standard versioned tables, and also allows some time travel functionality. Application periods can be used in PRIMARY/UNIQUE keys, foreign keys, and give nice new features to UPDATE and DELETE. They also allow "period predicates" which are the same kind of operations we already have for range types. All of that is for future patches that build on the infrastructure presented in this patch.

The SQL standard restricts period columns to dates or timestamps, but I'm allowing anything that has a btree operator class, as is the PostgreSQL way. System periods, once allowed, will only be timestamptz though. Unfortunately, I had to fully reserve the word PERIOD for this.

I'm looking for comments on everything except the pg_dump stuff, keeping in mind that inheritance is not finished either.

Thanks!

This is patch is based off of 71b349aef4.

Attachment Content-Type Size
periods.01.patch text/x-patch 93.8 KB

Responses

  • Re: Periods at 2018-05-27 07:48:35 from Pavel Stehule
  • Re: Periods at 2018-06-05 19:47:43 from Paul A Jungwirth

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-05-26 20:57:30 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid
Previous Message Andres Freund 2018-05-26 20:45:06 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid