From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
---|---|
To: | exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18674: Partitioned table doesn't depend on access method it uses |
Date: | 2024-10-27 20:23:23 |
Message-ID: | CALdSSPjGzuo0eodxdP9WZS4Q7nvv-2k3W=9ie2XoMedBjkr1Fw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sun, 27 Oct 2024 at 12:53, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> Hi!
>
> On Sat, 26 Oct 2024 at 19:27, PG Bug reporting form
> <noreply(at)postgresql(dot)org> wrote:
> >
> > The following bug has been logged on the website:
> >
> > Bug reference: 18674
> > Logged by: Alexander Lakhin
> > Email address: exclusion(at)gmail(dot)com
> > PostgreSQL version: 17.0
> > Operating system: Ubuntu 22.04
> > Description:
> >
> > The following script:
> > CREATE ACCESS METHOD ham TYPE TABLE HANDLER heap_tableam_handler;
> > CREATE TABLE pt (a int) PARTITION BY LIST (a) USING ham;
> > DROP ACCESS METHOD ham;
> >
> > ends successfully, with the access method dropped, though then:
> > CREATE TABLE tp1 PARTITION OF pt FOR VALUES IN (1);
> >
> > fails with
> > ERROR: cache lookup failed for access method 16385
> >
> > Whilst
> > CREATE TABLE t (a int) USING ham;
> > DROP ACCESS METHOD ham;
> >
> > fails with
> > ERROR: cannot drop access method ham because other objects depend on it
> > DETAIL: table t depends on access method ham
> > HINT: Use DROP ... CASCADE to drop the dependent objects too.
> >
> > Reproduced starting from 374c7a229.
> >
>
> Nice catch!
>
> Did you dig into reasons? I did a little...
>
> After looking closely at the DefineRelation workflow, I discovered
> that it is `RelationBuildLocalRelation` responsibility to add
> dependency between relation and its TAM. The bug arises from the fact
> that RELKIND_HAS_TABLE_AM doesn't respect partitioned relations.
> So, a trivial fix is attached.
>
> Does it look good for you?
>
> --
> Best regards,
> Kirill Reshke
As mentioned by Alexander off-list, v1 patch actually fails in a lot
of regression tests... My bad.
Seems that simply changing RELKIND_HAS_TABLE_AM marco is too invasive.
However, I will make another try. In v2 version, regression tests
still fail, i will adjust them, if patching this way is the right
approach to fix the problem..
script provided by Alexander:
CREATE ACCESS METHOD ham TYPE TABLE HANDLER heap_tableam_handler;
CREATE TABLE pt (a int) PARTITION BY LIST (a) USING ham;
DROP ACCESS METHOD ham;
now gives the correct output.
--
Best regards,
Kirill Reshke
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Change-RELKIND_HAS_TABLE_AM-to-support-partitione.patch | application/octet-stream | 4.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Muhammad Waqas | 2024-10-28 04:56:44 | Re: Installation Error: Column d.Dtaiculocale dose not exist Line 8 |
Previous Message | Kirill Reshke | 2024-10-27 07:53:45 | Re: BUG #18674: Partitioned table doesn't depend on access method it uses |