Re: Is there a work around for partition key needed for constraint

From: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
To: Jorge Torralba <jorge(dot)torralba(at)gmail(dot)com>
Cc: legrand_legrand(at)hotmail(dot)com, pgsql-admin(at)postgresql(dot)org
Subject: Re: Is there a work around for partition key needed for constraint
Date: 2018-10-24 22:33:17
Message-ID: CAODZiv7+Hf+b+W0Q34=j1W6HwbAOkxzxGoc5HDS9HB8OVva65w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Oct 24, 2018, 6:11 PM Jorge Torralba <jorge(dot)torralba(at)gmail(dot)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.

https://github.com/pgpartman/pg_partman

Keith

> On Wed, Oct 24, 2018 at 12:05 PM legrand legrand <
> legrand_legrand(at)hotmail(dot)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.
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Evan Bauer 2018-10-25 03:47:11 Re: Encryption / Decryption via PGCrypto
Previous Message Jorge Torralba 2018-10-24 22:11:04 Re: Is there a work around for partition key needed for constraint