I created the partitioned table in Postgres 15 with composite primary key:
CREATE TABLE T (
id bigserial NOT NULL,
date date,
...,
PRIMARY KEY(id, date)
) PARTITION BY RANGE (test_date);
I added several partitions like this:
CREATE TABLE T_2020 PARTITION OF T for values from ('2020-01-01') to ('2021-01-01');
CREATE TABLE T_2021 PARTITION OF T for values from ('2021-01-01') to ('2022-01-01');
Question: is it guaranteed that the id bigserial
column will be unique across all partitions?
I see from metadata that there is just 1 sequence for table T
created automatically for this bigserial
column. There is no individual sequence per partition.
Does it mean that id
column will be unique across all partitions?