Skip to content

Commit 1a568e5

Browse files
committed
docs: update reference documentation
1 parent 72a7c1d commit 1a568e5

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

doc/pg_partman.md

+21-17
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ create_parent(
195195
, p_template_table text DEFAULT NULL
196196
, p_jobmon boolean DEFAULT true
197197
, p_date_trunc_interval text DEFAULT NULL
198+
, p_control_not_null boolean DEFAULT true
198199
, p_time_encoder text DEFAULT NULL
199200
, p_time_decoder text DEFAULT NULL
200201
)
@@ -219,26 +220,29 @@ RETURNS boolean
219220
* `p_template_table` - If you do not pass a value here, a template table will automatically be made for you in same schema that pg_partman was installed to. If you pre-create a template table and pass its name here, then the initial child tables will obtain these properties discussed in the **About** section immediately.
220221
* `p_jobmon` - allow `pg_partman` to use the `pg_jobmon` extension to monitor that partitioning is working correctly. Defaults to TRUE.
221222
* `p_date_trunc_interval` - By default, pg_partman's time-based partitioning will truncate the child table starting values to line up at the beginning of typical boundaries (midnight for daily, day 1 for monthly, Jan 1 for yearly, etc). If a partitioning interval that does not fall on those boundaries is desired, this option may be required to ensure the child table has the expected boundaries (especially if you also set `p_start_partition`). The valid values allowed for this parameter are the interval values accepted by PostgreSQL's built-in `date_trunc()` function (day, week, month, etc). For example, if you set a 9-week interval, by default pg_partman would truncate the tables by month (since the interval is greater than one month but less than 1 year) and unexpectedly start on the first of the month in some cases. Set this parameter value to `week`, so that the child table start values are properly truncated on a weekly basis to line up with the 9-week interval. If you are using a custom time interval, please experiment with this option to get the expected set of child tables you desire or use a more typical partitioning interval to simplify partition management.
222-
* `p_time_encoder` - name of function that encodes a timestamp into a string representing your partition bounds. Setting this implicitly enables time based partitioning and is mandatory for text/uuid control column types. This enables paritioning tables using time based identifiers like uuidv7, ulid, snowflake ids and others. The function must handle NULL input safely. See test-time-daily.sql and test-uuid-daily for usage examples.
223-
* `p_time_decoder` - name of function that decodes a text/uuid control value into a timestamp. Setting this implicitly enables time based partitioning and is mandatory for text/uuid control column types. This enables paritioning tables using time based identifiers like uuidv7, ulid, snowflake ids and others. The function must handle NULL input safely. See test-time-daily.sql and test-uuid-daily for usage examples.
223+
* `p_control_not_null` - By default, this value is true and the control column must be set to NOT NULL. Setting this to false allows the control column to be NULL. Allowing this is not advised without very careful review and an explicit use-case defined as it can cause excessive data in the DEFAULT child partition.
224+
* `p_time_encoder` - name of function that encodes a timestamp into a string representing your partition bounds. Setting this implicitly enables time based partitioning and is mandatory for text/uuid control column types. This enables partitioning tables using time based identifiers like uuidv7, ulid, snowflake ids and others. The function must handle NULL input safely. See test-time-daily.sql and test-uuid-daily for usage examples.
225+
* `p_time_decoder` - name of function that decodes a text/uuid control value into a timestamp. Setting this implicitly enables time based partitioning and is mandatory for text/uuid control column types. This enables partitioning tables using time based identifiers like uuidv7, ulid, snowflake ids and others. The function must handle NULL input safely. See test-time-daily.sql and test-uuid-daily for usage examples.
224226

225227

226228
<a id="create_sub_parent"></a>
227229
```sql
228230
create_sub_parent(
229231
p_top_parent text
230-
, p_declarative_check text DEFAULT NULL
231232
, p_control text
232233
, p_interval text
233234
, p_type text DEFAULT 'range'
234-
, p_epoch text DEFAULT 'none'
235-
, p_premake int DEFAULT 4
236-
, p_start_partition text DEFAULT NULL
237235
, p_default_table boolean DEFAULT true
236+
, p_declarative_check text DEFAULT NULL
238237
, p_constraint_cols text[] DEFAULT NULL
238+
, p_premake int DEFAULT 4
239+
, p_start_partition text DEFAULT NULL
240+
, p_epoch text DEFAULT 'none'
239241
, p_jobmon boolean DEFAULT true
240242
, p_date_trunc_interval text DEFAULT NULL
243+
, p_control_not_null boolean DEFAULT true
241244
, p_time_encoder text DEFAULT NULL
245+
, p_time_decoder text DEFAULT NULL
242246
)
243247
RETURNS boolean
244248
```
@@ -251,20 +255,19 @@ RETURNS boolean
251255
* It is advised that you keep table names short for subpartition sets if you plan on relying on the table names for organization. The suffix added on to the end of a table name is always guaranteed to be there for whatever partition type is active for that set. Longer table names may cause the original parent table names to be truncated and possibly cut off the top level partitioning suffix. This cannot be controlled and ensures the lowest level partitioning suffix survives.
252256
* Note that for the first level of subpartitions, the `p_parent_table` argument you originally gave to `create_parent()` would be the exact same value you give to `create_sub_parent()`. If you need further subpartitioning, you would then start giving `create_sub_parent()` a different value (the child tables of the top level partition set).
253257
* The template table that is already set for the given p_top_parent will automatically be used.
254-
* `p_time_encoder` - name of function that encodes a timestamp into a string representing your partition bounds. Setting this implicitly enables time based partitioning and is mandatory for text/uuid control column types. This enables paritioning tables using time based identifiers like uuidv7, ulid, snowflake ids and others. The function must handle NULL input safely. See test-time-daily.sql and test-uuid-daily for usage examples.
255258

256259

257260
<a id="partition_data_time"></a>
258261
```sql
259262
partition_data_time(
260-
p_parent_table text
261-
, p_batch_count int DEFAULT 1
262-
, p_batch_interval interval DEFAULT NULL
263-
, p_lock_wait numeric DEFAULT 0
264-
, p_order text DEFAULT 'ASC'
265-
, p_analyze boolean DEFAULT true
266-
, p_source_table text DEFAULT NULL
267-
, p_ignored_columns text[] DEFAULT NULL
263+
p_parent_table text
264+
, p_batch_count int DEFAULT 1
265+
, p_batch_interval interval DEFAULT NULL
266+
, p_lock_wait numeric DEFAULT 0
267+
, p_order text DEFAULT 'ASC'
268+
, p_analyze boolean DEFAULT true
269+
, p_source_table text DEFAULT NULL
270+
, p_ignored_columns text[] DEFAULT NULL
268271
)
269272
RETURNS bigint
270273
```
@@ -287,6 +290,7 @@ RETURNS bigint
287290
<a id="partition_data_id"></a>
288291
```sql
289292
partition_data_id(p_parent_table text
293+
p_parent_table text
290294
, p_batch_count int DEFAULT 1
291295
, p_batch_interval bigint DEFAULT NULL
292296
, p_lock_wait numeric DEFAULT 0
@@ -321,8 +325,8 @@ partition_data_proc (
321325
, p_interval text DEFAULT NULL
322326
, p_lock_wait int DEFAULT 0
323327
, p_lock_wait_tries int DEFAULT 10
324-
, p_wait int DEFAULT 1, p_order text DEFAULT 'ASC'
325-
, p_order text DEFAULT 'ASC',
328+
, p_wait int DEFAULT 1
329+
, p_order text DEFAULT 'ASC'
326330
, p_source_table text DEFAULT NULL
327331
, p_ignored_columns text[] DEFAULT NULL
328332
, p_quiet boolean DEFAULT false

0 commit comments

Comments
 (0)