From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Partitioning by month causing an error?
Date: Fri, 20 Dec 2019 21:42:36 -0600
Message-ID: <8ba56626-3b91-6ac8-34a9-ab2c9ca2b8c6@gmail.com> (raw)
In-Reply-To: <9226.1576897186@sss.pgh.pa.us>
References: <CAOC+FBW=zSLyHWg2XDTp2eeEAmwzkzZLQPBqFx7_Cso=WMK3ew@mail.gmail.com>
<9226.1576897186@sss.pgh.pa.us>
On 12/20/19 8:59 PM, Tom Lane wrote:
> Wells Oliver <wells.oliver@gmail.com> writes:
>> 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?
> The rule is that a range partition from A to B covers values A <= X < B.
> So you should be using first-of-the-month dates for all of these
> values. As you have it, there's gaps in the allowable values,
> totally aside from the PITA factor of having to identify the last
> day of each month accurately.
If I were to ask to count *from* 1 *to* 100, you'd count from 1 to 100,
*not* 1 to 99. Who decided to arbitrarily break a grammatical rule we
(native English speakers, and I bet everyone else, too) all learn as
children, causing all sorts of needless confusion and breakage?
--
Angular momentum makes the world go 'round.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Partitioning by month causing an error?
In-Reply-To: <8ba56626-3b91-6ac8-34a9-ab2c9ca2b8c6@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox