Is there a work around for partition key needed for constraint

From: Jorge Torralba <jorge(dot)torralba(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Is there a work around for partition key needed for constraint
Date: 2018-10-24 18:56:53
Message-ID: CACut7uTMN=E-OK+gdvUU3BMn+O+OAbA9nd3R=W9wLfnvv2TaHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Working with postgres 11 now and trying to use declarative partition for
its benefits and ability to update data and move to the proper partition.
However, I am running into an issue with the limitation of having to
include the partition key as part of the unique constraint.

For example,

I have a table, call it xxx with

account_id, customer_id, date_added and so on ...._

partitioned by range on the date_added.

then a bunch of partition tables with a range.

I want to be able to use insert into xxx on conflict ( account_id,
customer_id ) do nothing.

However, since the requirements for a unique index on a partitioned table
must include the partition key of date_added, I am kind of stuck.

Is there anyway to create a unique constraint on a partitioned table
without using the column it is partitioned by ?

Thanks

--
Thanks,

Jorge Torralba
----------------------------

Note: This communication may contain privileged or other confidential
information. If you are not the intended recipient, please do not print,
copy, retransmit, disseminate or otherwise use the information. Please
indicate to the sender that you have received this email in error and
delete the copy you received. Thank You.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message legrand legrand 2018-10-24 19:04:40 Re: Is there a work around for partition key needed for constraint
Previous Message ZongtianHou 2018-10-24 09:54:41 Re: Can I add a column in catalog table as a superuser