CREATE TABLE IF NOT EXISTS public.hfj_resource
(
res_id bigint NOT NULL,
partition_id integer NOT NULL,
res_version character varying(7) COLLATE pg_catalog."default",
fhir_id character varying(64) COLLATE pg_catalog."default",
partition_date date,
res_type character varying(40) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT hfj_resource_pkey PRIMARY KEY (res_id, partition_id),
CONSTRAINT idx_res_type_fhir_id UNIQUE (partition_id, res_type, fhir_id)
)
With this change to include the partition_id (as Postgres would require for partitioning), wouldn't it mean that different partitions could leverage the same res_id primary key?
And likewise, wouldn't we now allow Resource/fhir_id collisions across partitions?
Are these constraints being preserved in the software instead, which allows us to relax these constraints in the schema? And if so, do we still need to retain the idx_res_type_fhir_id constraint?
Thanks!
Jason