File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ create table t1 {
176176		BUSINESS(bus_start, bus_end) 
177177	} 
178178	constraints { 
179- 		"PK" -> no_overlap< bus_start: bus_end>  
179+ 		no_overlap  "PK" -> bus_start :  bus_end 
180180	} 
181181} 
182182``` 
@@ -337,7 +337,7 @@ create table t1 {
337337        SYSTEM(sys_start, sys_end) 
338338    } 
339339    constraints { 
340-         "PK" -> no_overlap< bus_start: bus_end>  
340+         no_overlap  "PK" -> bus_start :  bus_end 
341341    } 
342342} 
343343``` 
Original file line number Diff line number Diff line change @@ -333,6 +333,13 @@ inclusive-exclusive (close-open) approach for the range. The `start` and `end` c
333333"greater than all". Comdb2 also generates implicit constraint to enforce that ` start `  is strictly less than ` end ` 
334334for every row in the table.
335335
336+ ` no_overlap `  constraints can also be used together with indexes on expressions. Simply set ` start `  and ` end `  to be
337+ the one of the key fields defined in the key section of the schema.
338+ 
339+ Here is an example:
340+ 
341+ 
342+ 
336343Once a ` no_overlap `  constraint is defined on a key, Comdb2 enforces that there cannot be more than one rows
337344with identical values in all key fields (other than ` start `  and ` end ` ) in any interval range ` [start, end) ` .
338345
Original file line number Diff line number Diff line change @@ -503,9 +503,10 @@ set all_graphs {
503503  }
504504
505505  constraint-section {
506-       loop {line /keyname ->
506+       loop {line {opt {line /no_overlap}}
507+                  /keyname ->
507508                 {or {line /table-name : /keyname}
508-                      {line /no_overlap / start : /end}
509+                      {line /start : /end}
509510                 }
510511           }
511512  }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments