Re: Postgres 11: Table Partitioning and Primary Keys

2019-07-10 Thread Michael Paquier
On Tue, Jul 09, 2019 at 06:59:59PM -0400, Tom Lane wrote:
> Alvaro Herrera  writes:
>>  
>>   
>>Unique constraints on partitioned tables (as well as primary keys)
>>must constrain all the partition key columns.  This limitation exists
>>because PostgreSQL can only enforce
>>uniqueness in each partition individually.
>>   
>>  
> 
>> I'm not really sure about the "must constrain" verbiage.  Is that really
>> comprehensible?
> 
> I think "must include" might be better.

+1.

>> which may not be the pinnacle of clarity, but took some time to craft
>> and I think is correct.  Also it doesn't mention primary keys
>> explicitly; maybe we should patch it by adding "(as well as a primary
>> key)" right after "a unique constraint".  Thoughts?
> 
> I'd leave that alone.  I don't think the parenthetical comment about
> primary keys in your new text is adding much either.

Agreed with not bothering about this block and not adding the
parenthetical comment.
--
Michael


signature.asc
Description: PGP signature


Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

2019-07-10 Thread David Harper
> I actually agree with your opinion that "midnight" is fine.
> That text has been that way for over fifteen years[1], and
> nobody's complained before that it was ambiguous.

Conversely, how many users over the past fifteen years have read that table, 
and then felt compelled (as I did) to run a query such as

  select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;

on their PostgreSQL cluster to clear the ambiguity for themselves?

Best regards

David Harper

Wellcome Sanger Institute, Cambridge, England

--
 The Wellcome Sanger Institute is operated by Genome Research
 Limited, a charity registered in England with number 1021457 and a
 company registered in England with number 2742969, whose registered
 office is 215 Euston Road, London, NW1 2BE.




Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

2019-07-10 Thread Jonathan S. Katz
On 7/10/19 6:13 AM, David Harper wrote:
>> I actually agree with your opinion that "midnight" is fine.
>> That text has been that way for over fifteen years[1], and
>> nobody's complained before that it was ambiguous.
> 
> Conversely, how many users over the past fifteen years have read that table, 
> and then felt compelled (as I did) to run a query such as
> 
>   select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;
> 
> on their PostgreSQL cluster to clear the ambiguity for themselves?

I've heard of one, but only just recently :)

If we were to s/midnight/00:00:00/ we'd probably want to do it
everywhere midnight appears. This occurs in a few places in the docs:

https://www.postgresql.org/docs/current/functions-formatting.html ()
https://www.postgresql.org/docs/current/protocol-replication.html
(XlogData section)

and there are some various code comments as well.

Count me as a +0 vote, as I've always interpreted it the way Bruce & Tom
said upthread, but if we want to change it I can write a patch.

Jonathan



signature.asc
Description: OpenPGP digital signature


Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

2019-07-10 Thread Bruce Momjian
On Wed, Jul 10, 2019 at 01:32:31PM -0400, Jonathan Katz wrote:
> On 7/10/19 6:13 AM, David Harper wrote:
> >> I actually agree with your opinion that "midnight" is fine.
> >> That text has been that way for over fifteen years[1], and
> >> nobody's complained before that it was ambiguous.
> > 
> > Conversely, how many users over the past fifteen years have read that 
> > table, and then felt compelled (as I did) to run a query such as
> > 
> >   select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;
> > 
> > on their PostgreSQL cluster to clear the ambiguity for themselves?
> 
> I've heard of one, but only just recently :)
> 
> If we were to s/midnight/00:00:00/ we'd probably want to do it
> everywhere midnight appears. This occurs in a few places in the docs:
> 
> https://www.postgresql.org/docs/current/functions-formatting.html ()
> https://www.postgresql.org/docs/current/protocol-replication.html
> (XlogData section)
> 
> and there are some various code comments as well.
> 
> Count me as a +0 vote, as I've always interpreted it the way Bruce & Tom
> said upthread, but if we want to change it I can write a patch.

The thing I don't like about 00:00:00 is that it is a lot of information
to say "the start of the day", while I assumed midnight was clear on
that.  If we can find  a way to say "start of the day (midnight)", that
would work.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+  Ancient Roman grave inscription +




Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

2019-07-10 Thread Tom Lane
Bruce Momjian  writes:
> The thing I don't like about 00:00:00 is that it is a lot of information
> to say "the start of the day", while I assumed midnight was clear on
> that.  If we can find  a way to say "start of the day (midnight)", that
> would work.

One really simple way to make it shorter is to say "00:00", leaving
out the seconds.

regards, tom lane