Re: Partitioning by month causing an error?

From: Gaetano Mendola <mendola(at)gmail(dot)com>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Partitioning by month causing an error?
Date: 2019-12-21 10:09:40
Message-ID: CAJycT5rRbAsO-5wzz3fb7umBD=gjKvW6Oe=OkjpARAdWTqSvrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, Dec 21, 2019 at 1:49 AM Wells Oliver <wells(dot)oliver(at)gmail(dot)com> wrote:
>
> I have a partition per each month, like this:
>
> CREATE TABLE mmd_yr2019_3 PARTITION OF mmd FOR VALUES FROM ('2019-03-01') TO ('2019-03-31');
> CREATE TABLE mmd_yr2019_4 PARTITION OF mmd FOR VALUES FROM ('2019-04-01') TO ('2019-04-30');
>
> This breaks for dates at the end of the month. What's the better way to write the bounds? 3/1 to 4/1 and then 4/1 to 5/1? Does that cause some overlap issue?

This should have been:

CREATE TABLE mmd_yr2019_3 PARTITION OF mmd FOR VALUES FROM
('2019-03-01') TO ('2019-04-01');
CREATE TABLE mmd_yr2019_4 PARTITION OF mmd FOR VALUES FROM
('2019-04-01') TO ('2019-04-30');

--
cpp-today.blogspot.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message soumik.bhattacharjee 2019-12-23 19:30:16 Cannot connect to postgresql on port 5432
Previous Message Ron 2019-12-21 06:43:19 Re: Partitioning by month causing an error?