From: | amul sul <sulamul(at)gmail(dot)com> |
---|---|
To: | Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Multiple primary key on partition table? |
Date: | 2018-09-18 05:49:44 |
Message-ID: | CAAJ_b945gAp34GP7CPXh1=sp-TvArGbUdVsC6gk0vzS+fUOePQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Sep 17, 2018 at 9:06 PM amul sul <sulamul(at)gmail(dot)com> wrote:
>
> Nice catch Rajkumar.
>
> In index_check_primary_key(), relationHasPrimaryKey() called only for the an
> alter command but I think we need to call in this case as well, like this:
>
> diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
> index 7eb3e35166..c8714395fe 100644
> --- a/src/backend/catalog/index.c
> +++ b/src/backend/catalog/index.c
> @@ -223,7 +223,7 @@ index_check_primary_key(Relation heapRel,
> * and CREATE INDEX doesn't have a way to say PRIMARY KEY, so it's no
> * problem either.
> */
> - if (is_alter_table &&
> + if ((is_alter_table || heapRel->rd_rel->relispartition) &&
> relationHasPrimaryKey(heapRel))
> {
> ereport(ERROR,
>
> Thoughts?
>
Here is the complete patch proposes the aforesaid fix with regression test.
Regards,
Amul
Attachment | Content-Type | Size |
---|---|---|
0001-multiple-primary-key-restriction-for-a-partition-tab.patch | application/x-patch | 2.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-09-18 05:51:42 | Re: Cache lookup errors with functions manipulation object addresses |
Previous Message | Prabhat Sahu | 2018-09-18 05:43:47 | Difference in TO_TIMESTAMP results. |