Re: Declarative partitioning - another take - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: Declarative partitioning - another take
Date
Msg-id CADkLM=dt=mWtguYbOrZ1dwUsdMEz_OXc5+66g9=hVi5yK=ARgg@mail.gmail.com
Whole thread Raw
In response to Re: Declarative partitioning - another take  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-hackers
OTOH I've seen a lot of people bitten by [2014-01-01,2014-12-31] on
TIMESTAMP intervals.

No argument there.
 
Everybody remembers december has 31 days, but when we have to do
MONTHLY partitions if you use closed intervals someone always miskeys
the number of days, or forgets wheter a particular year is leap or
not, and when doing it automatically I always have to code it as start
+ 1 month - 1day. In my experience having the non-significant part of
the dates ( days in monthly case, months too in yearly cases ) both 1
and equal in start and end makes it easier to check and identify, and
less error prone.

Being able to define partitions by expressions based on the values I want would be a good thing.
 
You just do the classical ( I've had to do it ) closed end || minimum
char ( "XYZ","XYZ\0" in this case ). It is not that difficult as
strings have a global order, the next string to any one is always that
plus the \0, or whatever your minimum is.

I've thought about doing that in the past, but wasn't sure it would actually work correctly. If you have experience with it doing so, that would be encouraging. How does that *look* when you print your partition layout though?
 

pgsql-hackers by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: Declarative partitioning - another take
Next
From: Alvaro Herrera
Date:
Subject: Re: DROP FUNCTION of multiple functions