| From: | Siddharth Jain <siddhsql(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Question on creating keys on partitioned tables |
| Date: | 2023-03-31 17:35:21 |
| Message-ID: | CAPqV3pRPDM06rGQxaWWeY7XmwdtLOqOzizqo-DRkJWErX8dy1g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, Mar 31, 2023 at 9:07 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Siddharth Jain <siddhsql(at)gmail(dot)com> writes:
> > I think the two are equivalent. If not, could you please explain why?
>
> Well, they're formally equivalent if you require there to be only one
> X value per partition (ie, PARTITION BY LIST with only one listed value
> per partition); if there's more, they're not the same thing.
>
Yes. This is what I have. I think I understand now. Is following correct?
when a PK is created on (X,Y) on the parent table what happens internally
is that the command is run individually on each of the child tables.
nothing more. nothing less.
>
> Neither one guarantees that Y is globally unique. We have no mechanism
> for enforcing uniqueness across partitions except for partition key
> columns.
>
> regards, tom lane
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryn Llewellyn | 2023-03-31 19:35:08 | My tests show that a WITH HOLD cursor has subtly different semantics from a WITHOUT HOLD cursor |
| Previous Message | Tom Lane | 2023-03-31 16:06:59 | Re: Question on creating keys on partitioned tables |