Re: dropping column prevented due to inherited index - Mailing list pgsql-hackers

From Ashutosh Sharma
Subject Re: dropping column prevented due to inherited index
Date
Msg-id CAE9k0P=0cZCW8RaFD_ceorum_T+AB0K1TwP0YaM5XpeArDuagw@mail.gmail.com
Whole thread Raw
In response to Re: dropping column prevented due to inherited index  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: dropping column prevented due to inherited index  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
I think we could have first deleted all the dependency of child object
on parent and then deleted the child itself using performDeletion().
As an example let's consider the case of toast table where we first
delete the dependency of toast relation on main relation and then
delete the toast table itself otherwise the toast table deletion would
fail. But, the problem I see here is that currently we do not have any
entry in pg_attribute table that would tell us about the dependency of
child column on parent.

-- 
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

On Mon, Oct 7, 2019 at 7:31 AM Amit Langote <amitlangote09@gmail.com> wrote:
>
> Hello,
>
> On Fri, Oct 4, 2019 at 5:57 PM Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Thu, Oct 03, 2019 at 09:18:12AM -0300, Alvaro Herrera wrote:
> > > Hmm.  I wonder if we shouldn't adopt the coding pattern we've used
> > > elsewhere of collecting all columns to be dropped first into an
> > > ObjectAddresses array, then use performMultipleDeletions.
> >
> > +1.  That's the common pattern these days, because that's more
> > performant.
>
> Actually I don't see the peformMultipleDeletions() pattern being used
> for the situations where there are multiple objects to drop due to
> inheritance.  I only see it where there are multiple objects related
> to one table.  Maybe it's possible to apply to the inheritance
> situation though, but in this particular case, it seems a bit hard to
> do, because ATExecDropColumn steps through an inheritance tree level
> at a time.
>
> But maybe I misunderstood Alvaro's suggestion?
>
> >  I think that the patch should have regression tests.
>
> I have added one in the attached updated patch.
>
> Thanks,
> Amit



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] Block level parallel vacuum
Next
From: David Rowley
Date:
Subject: Re: Change atoi to strtol in same place