Naming of new EXCLUDE constraints

Поиск
Список
Период
Сортировка
Искать

Naming of new EXCLUDE constraints

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Simon Riggs wrote:
> On Sun, 2010-04-04 at 22:12 -0400, Bruce Momjian wrote:
> > Simon Riggs wrote:
> > > 
> > > How about we call it "exclusivity constraints".
> > > 
> > > Not much of a change, but helps to differentiate.
> > 
> > Well, the keyword is EXCLUDE so we could call it "EXCLUDE contraints".
> 
> If that is the keyword then that is what people will use, agreed.
> 
> That is poor English, but I think we can reword the sentences to allow
> that phrase to make sense.
> 
> e.g. Added capability for EXCLUDE constraints.

I have modified the documentation with the attached patch to call this
new features "exclude constraints".  Is this what everyone wants?

-- 
  Bruce Momjian          http://momjian.us
  EnterpriseDB                             http://enterprisedb.com
Index: doc/src/sgml/catalogs.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v
retrieving revision 2.225
diff -c -c -r2.225 catalogs.sgml
*** doc/src/sgml/catalogs.sgml	3 Apr 2010 07:22:52 -0000	2.225
--- doc/src/sgml/catalogs.sgml	13 Apr 2010 01:26:31 -0000
***************
*** 1701,1707 ****
  
    
     The catalog pg_constraint stores check, primary
!    key, unique, foreign key, and exclusion constraints on tables.
     (Column constraints are not treated specially.  Every column constraint is
     equivalent to some table constraint.)
     Not-null constraints are represented in the pg_attribute</>
--- 1701,1707 ----
  
    
     The catalog pg_constraint stores check, primary
!    key, unique, foreign key, and exclude constraints on tables.
     (Column constraints are not treated specially.  Every column constraint is
     equivalent to some table constraint.)
     Not-null constraints are represented in the pg_attribute</>
***************
*** 1757,1763 ****
          p</> = primary key constraint,
          u</> = unique constraint,
          t</> = constraint trigger,
!         x</> = exclusion constraint
        
       
  
--- 1757,1763 ----
          p</> = primary key constraint,
          u</> = unique constraint,
          t</> = constraint trigger,
!         x</> = exclude constraint
        
       
  
***************
*** 1794,1800 ****
        oid
        pg_class.oid
        The index supporting this constraint, if it's a unique, primary
!        key, foreign key, or exclusion constraint; else 0
       
  
       
--- 1794,1800 ----
        oid
        pg_class.oid
        The index supporting this constraint, if it's a unique, primary
!        key, foreign key, or exclude constraint; else 0
       
  
       
***************
*** 1902,1908 ****
        conexclop
        oid[]
        pg_operator.oid</>
!       If an exclusion constraint, list of the per-column exclusion operators
       
  
       
--- 1902,1908 ----
        conexclop
        oid[]
        pg_operator.oid</>
!       If an exclude constraint, list of the per-column exclusion operators
       
  
       
***************
*** 1923,1929 ****
    
  
    
!    In the case of an exclusion constraint, conkey
     is only useful for constraint elements that are simple column references.
     For other cases, a zero appears in conkey
     and the associated index must be consulted to discover the expression
--- 1923,1929 ----
    
  
    
!    In the case of an exclude constraint, conkey
     is only useful for constraint elements that are simple column references.
     For other cases, a zero appears in conkey
     and the associated index must be consulted to discover the expression
***************
*** 1946,1952 ****
      pg_class.relchecks needs to agree with the
      number of check-constraint entries found in this table for each
      relation.  Also, pg_class.relhasexclusion must
!     be true if there are any exclusion-constraint entries for the relation.
     
    
  
--- 1946,1952 ----
      pg_class.relchecks needs to agree with the
      number of check-constraint entries found in this table for each
      relation.  Also, pg_class.relhasexclusion must
!     be true if there are any exclude-constraint entries for the relation.
     
    
  
Index: doc/src/sgml/ddl.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v
retrieving revision 1.93
diff -c -c -r1.93 ddl.sgml
*** doc/src/sgml/ddl.sgml	6 Apr 2010 02:18:04 -0000	1.93
--- doc/src/sgml/ddl.sgml	13 Apr 2010 01:26:31 -0000
***************
*** 847,856 ****
    
  
    
!    Exclusion constraints
  
     
!     exclusion constraint
     
  
     
--- 847,856 ----
    
  
    
!    Exclude constraints
  
     
!     exclude constraint
     
  
     
***************
*** 859,865 ****
     
  
     
!     Exclusion constraints ensure that if any two rows are compared on
      the specified columns or expressions using the specified operators,
      at least one of these operator comparisons will return false or null.
      The syntax is:
--- 859,865 ----
     
  
     
!     Exclude constraints ensure that if any two rows are compared on
      the specified columns or expressions using the specified operators,
      at least one of these operator comparisons will return false or null.
      The syntax is:
Index: doc/src/sgml/release-9.0.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/release-9.0.sgml,v
retrieving revision 2.15
diff -c -c -r2.15 release-9.0.sgml
*** doc/src/sgml/release-9.0.sgml	5 Apr 2010 02:46:42 -0000	2.15
--- doc/src/sgml/release-9.0.sgml	13 Apr 2010 01:26:31 -0000
***************
*** 2740,2748 ****
         
         
          
!          Add exclusion constraints, which generalize the concept of
            uniqueness to support any indexable commutative operator, not just
!           equality. Two rows violate the exclusion constraint if
            "row1.col OP row2.col" is TRUE for each of the columns in
            the constraint.
          
--- 2740,2748 ----
         
         
          
!          Add EXCLUDE</> constraints, which generalize the concept of
            uniqueness to support any indexable commutative operator, not just
!           equality. Two rows violate the EXCLUDE</> constraint if
            "row1.col OP row2.col" is TRUE for each of the columns in
            the constraint.
          
Index: doc/src/sgml/ref/create_table.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v
retrieving revision 1.125
diff -c -c -r1.125 create_table.sgml
*** doc/src/sgml/ref/create_table.sgml	3 Apr 2010 07:23:00 -0000	1.125
--- doc/src/sgml/ref/create_table.sgml	13 Apr 2010 01:26:31 -0000
***************
*** 459,472 ****
      EXCLUDE [ USING index_method ] ( exclude_element WITH operator [, ... ] ) index_parameters [ WHERE ( predicate ) ]
      
       
!       The EXCLUDE</> clause defines an exclusion
        constraint, which guarantees that if
        any two rows are compared on the specified column(s) or
        expression(s) using the specified operator(s), not all of these
        comparisons will return TRUE</>.  If all of the
        specified operators test for equality, this is equivalent to a
        UNIQUE</> constraint, although an ordinary unique constraint
!       will be faster.  However, exclusion constraints can specify
        constraints that are more general than simple equality.
        For example, you can specify a constraint that
        no two rows in the table contain overlapping circles
--- 459,472 ----
      EXCLUDE [ USING index_method ] ( exclude_element WITH operator [, ... ] ) index_parameters [ WHERE ( predicate ) ]
      
       
!       The EXCLUDE</> clause defines an exclude
        constraint, which guarantees that if
        any two rows are compared on the specified column(s) or
        expression(s) using the specified operator(s), not all of these
        comparisons will return TRUE</>.  If all of the
        specified operators test for equality, this is equivalent to a
        UNIQUE</> constraint, although an ordinary unique constraint
!       will be faster.  However, exclude constraints can specify
        constraints that are more general than simple equality.
        For example, you can specify a constraint that
        no two rows in the table contain overlapping circles
***************
*** 475,481 ****
       
  
       
!       Exclusion constraints are implemented using
        an index, so each specified operator must be associated with an
        appropriate operator class
        (see ) for the index access
--- 475,481 ----
       
  
       
!       Exclude constraints are implemented using
        an index, so each specified operator must be associated with an
        appropriate operator class
        (see ) for the index access
***************
*** 491,504 ****
        The access method must support amgettuple</> (see ); at present this means GIN</>
        cannot be used.  Although it's allowed, there is little point in using
!       btree or hash indexes with an exclusion constraint, because this
        does nothing that an ordinary unique constraint doesn't do better.
        So in practice the access method will always be GiST</>.
       
  
       
        The predicate</> allows you to specify an
!       exclusion constraint on a subset of the table; internally this creates a
        partial index. Note that parentheses are required around the predicate.
       
      
--- 491,504 ----
        The access method must support amgettuple</> (see ); at present this means GIN</>
        cannot be used.  Although it's allowed, there is little point in using
!       btree or hash indexes with an exclude constraint, because this
        does nothing that an ordinary unique constraint doesn't do better.
        So in practice the access method will always be GiST</>.
       
  
       
        The predicate</> allows you to specify an
!       exclude constraint on a subset of the table; internally this creates a
        partial index. Note that parentheses are required around the predicate.
       
      
***************
*** 1176,1182 ****
    
  
    
!    Create table circles</> with an exclusion
     constraint that prevents any two circles from overlapping:
  
  
--- 1176,1182 ----
    
  
    
!    Create table circles</> with an exclude
     constraint that prevents any two circles from overlapping:
  
  
Index: doc/src/sgml/ref/set_constraints.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v
retrieving revision 1.19
diff -c -c -r1.19 set_constraints.sgml
*** doc/src/sgml/ref/set_constraints.sgml	3 Apr 2010 07:23:02 -0000	1.19
--- doc/src/sgml/ref/set_constraints.sgml	13 Apr 2010 01:26:35 -0000
***************
*** 73,79 ****
     NOT NULL</> and CHECK</> constraints are
     always checked immediately when a row is inserted or modified
     (not</> at the end of the statement).
!    Uniqueness and exclusion constraints that have not been declared
     DEFERRABLE</> are also checked immediately.
    
  
--- 73,79 ----
     NOT NULL</> and CHECK</> constraints are
     always checked immediately when a row is inserted or modified
     (not</> at the end of the statement).
!    Uniqueness and exclude constraints that have not been declared
     DEFERRABLE</> are also checked immediately.
    
  

Re: Naming of new EXCLUDE constraints

От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Mon, Apr 12, 2010 at 9:28 PM, Bruce Momjian  wrote:
> Simon Riggs wrote:
>> On Sun, 2010-04-04 at 22:12 -0400, Bruce Momjian wrote:
>> > Simon Riggs wrote:
>> > >
>> > > How about we call it "exclusivity constraints".
>> > >
>> > > Not much of a change, but helps to differentiate.
>> >
>> > Well, the keyword is EXCLUDE so we could call it "EXCLUDE contraints".
>>
>> If that is the keyword then that is what people will use, agreed.
>>
>> That is poor English, but I think we can reword the sentences to allow
>> that phrase to make sense.
>>
>> e.g. Added capability for EXCLUDE constraints.
>
> I have modified the documentation with the attached patch to call this
> new features "exclude constraints".  Is this what everyone wants?

I don't think we should be changing this without input from a lot more
people.  We had a very, very long dicussion of this when this was
initially under development.  Changing it now seems like a good way to
reopen a can of worms.

...Robert

Re: Naming of new EXCLUDE constraints

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Robert Haas wrote:
> On Mon, Apr 12, 2010 at 9:28 PM, Bruce Momjian  wrote:
> > Simon Riggs wrote:
> >> On Sun, 2010-04-04 at 22:12 -0400, Bruce Momjian wrote:
> >> > Simon Riggs wrote:
> >> > >
> >> > > How about we call it "exclusivity constraints".
> >> > >
> >> > > Not much of a change, but helps to differentiate.
> >> >
> >> > Well, the keyword is EXCLUDE so we could call it "EXCLUDE contraints".
> >>
> >> If that is the keyword then that is what people will use, agreed.
> >>
> >> That is poor English, but I think we can reword the sentences to allow
> >> that phrase to make sense.
> >>
> >> e.g. Added capability for EXCLUDE constraints.
> >
> > I have modified the documentation with the attached patch to call this
> > new features "exclude constraints". ?Is this what everyone wants?
> 
> I don't think we should be changing this without input from a lot more
> people.  We had a very, very long dicussion of this when this was
> initially under development.  Changing it now seems like a good way to
> reopen a can of worms.

Fine, then we will just have to live with "exclusion constraints" and
"contraint exclusion".

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

Re: Naming of new EXCLUDE constraints

От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Mon, Apr 12, 2010 at 11:03 PM, Bruce Momjian  wrote:
> Robert Haas wrote:
>> On Mon, Apr 12, 2010 at 9:28 PM, Bruce Momjian  wrote:
>> > Simon Riggs wrote:
>> >> On Sun, 2010-04-04 at 22:12 -0400, Bruce Momjian wrote:
>> >> > Simon Riggs wrote:
>> >> > >
>> >> > > How about we call it "exclusivity constraints".
>> >> > >
>> >> > > Not much of a change, but helps to differentiate.
>> >> >
>> >> > Well, the keyword is EXCLUDE so we could call it "EXCLUDE contraints".
>> >>
>> >> If that is the keyword then that is what people will use, agreed.
>> >>
>> >> That is poor English, but I think we can reword the sentences to allow
>> >> that phrase to make sense.
>> >>
>> >> e.g. Added capability for EXCLUDE constraints.
>> >
>> > I have modified the documentation with the attached patch to call this
>> > new features "exclude constraints". ?Is this what everyone wants?
>>
>> I don't think we should be changing this without input from a lot more
>> people.  We had a very, very long dicussion of this when this was
>> initially under development.  Changing it now seems like a good way to
>> reopen a can of worms.
>
> Fine, then we will just have to live with "exclusion constraints" and
> "contraint exclusion".

I am not necessarily 100% averse to changing it... just saying that it
shouldn't be done unless we have a clear consensus to overrule the
previous consensus.

...Robert

Re: Naming of new EXCLUDE constraints

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Robert Haas  writes:
> On Mon, Apr 12, 2010 at 11:03 PM, Bruce Momjian  wrote:
>> Fine, then we will just have to live with "exclusion constraints" and
>> "contraint exclusion".

> I am not necessarily 100% averse to changing it... just saying that it
> shouldn't be done unless we have a clear consensus to overrule the
> previous consensus.

Well, I'm completely unimpressed with the proposed text, which includes
phrases like "uniqueness and exclude constraints".  That leaves nothing
but the impression that these people don't speak the English too good.
		regards, tom lane

Re: Naming of new EXCLUDE constraints

От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
Tom Lane escribió:
> Robert Haas  writes:
> > On Mon, Apr 12, 2010 at 11:03 PM, Bruce Momjian  wrote:
> >> Fine, then we will just have to live with "exclusion constraints" and
> >> "contraint exclusion".
> 
> > I am not necessarily 100% averse to changing it... just saying that it
> > shouldn't be done unless we have a clear consensus to overrule the
> > previous consensus.
> 
> Well, I'm completely unimpressed with the proposed text, which includes
> phrases like "uniqueness and exclude constraints".  That leaves nothing
> but the impression that these people don't speak the English too good.

I think a simple fix would be to say "don't confuse exclusion contraints
with constraint exclusion" somewhere (presumably in documentation for
both features), just to raise awareness of the difference.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

FAQ