diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 0478e40447d..bc014d0879f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -86,8 +86,9 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI and partition_bound_spec is: -{ IN ( { bound_literal | NULL } [, ...] ) | - FROM ( { bound_literal | UNBOUNDED } [, ...] ) TO ( { bound_literal | UNBOUNDED } [, ...] ) } +IN ( { numeric_literal | string_literal | NULL } [, ...] ) | +FROM ( { numeric_literal | string_literal | UNBOUNDED } [, ...] ) + TO ( { numeric_literal | string_literal | UNBOUNDED } [, ...] ) index_parameters in UNIQUE, PRIMARY KEY, and EXCLUDE constraints are: @@ -252,44 +253,26 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI PARTITION OF parent_table FOR VALUES partition_bound_spec - Creates the table as partition of the specified + Creates the table as a partition of the specified parent table. - The partition bound specification must correspond to the partitioning - method and partition key of the parent table, and must not overlap with - any existing partition of that parent. + The partition_bound_spec + must correspond to the partitioning method and partition key of the + parent table, and must not overlap with any existing partition of that + parent. The form with IN is used for list partitioning, + while the form with FROM and TO is used for + range partitioning. - Each of the values specified in the partition bound specification is + Each of the values specified in + the partition_bound_spec is a literal, NULL, or UNBOUNDED. - A literal is either a numeric constant or a string constant that is - coercible to the corresponding partition key column's type. - - - - When creating a range partition, the lower bound specified with - FROM is an inclusive bound, whereas the upper - bound specified with TO is an exclusive bound. - That is, the values specified in the FROM list - are accepted values of the corresponding partition key columns in a - given partition, whereas those in the TO list are - not. To be precise, this applies only to the first of the partition - key columns for which the corresponding values in the FROM - and TO lists are not equal. All rows in a given - partition contain the same values for all preceding columns, equal to - those specified in FROM and TO - lists. On the other hand, any subsequent columns are insignificant - as far as implicit partition constraint is concerned. - - - - Specifying UNBOUNDED in FROM - signifies -infinity as the lower bound of the - corresponding column, whereas it signifies +infinity - as the upper bound when specified in TO. + Each literal value must be either a numeric constant that is coercible + to the corresponding partition key column's type, or a string literal + that is valid input for that type. @@ -300,6 +283,32 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI cannot be specified for range partitions. + + When creating a range partition, the lower bound specified with + FROM is an inclusive bound, whereas the upper + bound specified with TO is an exclusive bound. + That is, the values specified in the FROM list + are valid values of the corresponding partition key columns for this + partition, whereas those in the TO list are + not. Note that this statement must be understood according to the + rules of row-wise comparison (). + For example, given PARTITION BY RANGE (x,y), a partition + bound FROM (1, 2) TO (3, 4) + allows x=1 with any y>=2, + x=2 with any non-null y, + and x=3 with any y<4. + + + + Writing UNBOUNDED in FROM + signifies -infinity as the lower bound of the + corresponding column, whereas when written in TO, + it signifies +infinity as the upper bound. + All items following an UNBOUNDED item within + a FROM or TO list must also + be UNBOUNDED. + + A partition must have the same column names and types as the partitioned table to which it belongs. If the parent is specified WITH @@ -318,8 +327,9 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI Rows inserted into a partitioned table will be automatically routed to the correct partition. If no suitable partition exists, an error will - occur. Also, if updating a row in a given partition causes it to move - to another partition due to the new partition key, an error will occur. + occur. Also, if updating a row in a given partition would require it + to move to another partition due to new partition key values, an error + will occur.