Re: Is there a work around for partition key needed for constraint - Mailing list pgsql-admin

From Keith Fiske
Subject Re: Is there a work around for partition key needed for constraint
Date
Msg-id CAODZiv7+Hf+b+W0Q34=j1W6HwbAOkxzxGoc5HDS9HB8OVva65w@mail.gmail.com
Whole thread Raw
In response to Re: Is there a work around for partition key needed for constraint  (Jorge Torralba <jorge.torralba@gmail.com>)
Responses Re: Is there a work around for partition key needed for constraint  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-admin


On Wed, Oct 24, 2018, 6:11 PM Jorge Torralba <jorge.torralba@gmail.com> wrote:
Wow, thats a convoluted solution and I don't know if it will allow the use of upsert. I hope this solution is in the works :(



I have a workaround for this in pg_partman. It uses a template table to apply the unique indexes to the child tables. Note that it doesn't enforce the unique constraint across all the child tables, only each child table. Since you're doing ON CONFLICT DO NOTHING, this may work ok for your situation tho. I don't think it would work if you needed it to move the rows between partitions on conflict tho, unless the constraint was part of the partition key. 

The real solution will have to wait on a global index in a future version. 


Keith



On Wed, Oct 24, 2018 at 12:05 PM legrand legrand <legrand_legrand@hotmail.com> wrote:
Hi
something similar is already discussed here:

https://www.postgresql-archive.org/PostgreSQL-11-global-index-td6032681.html

Regards
PAscal



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html



--
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.

pgsql-admin by date:

Previous
From: Jorge Torralba
Date:
Subject: Re: Is there a work around for partition key needed for constraint
Next
From: Evan Bauer
Date:
Subject: Re: Encryption / Decryption via PGCrypto