To generate a check constraint for partitioning tables, it is necessary to be able to create an ulid for a specific datetime like so:
CREATE TABLE "table" (
id uuid primary key not null default ulid_generate(),
...
) partition by range (id);
CREATE TABLE table_2021 partition of "table" for values
from
ulid_generate('2021-01-01 00:00:00') --0176bb3e-7000-0000-0000-000000000000
to
ulid_generate('2022-01-01 00:00:00'); --017e12ef-9c00-0000-0000-000000000000
(it is also possible with the random part of ulid - it does not matter much)
To generate a check constraint for partitioning tables, it is necessary to be able to create an ulid for a specific datetime like so:
(it is also possible with the random part of ulid - it does not matter much)