Re: dropping column prevented due to inherited index

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: dropping column prevented due to inherited index
Date: 2019-10-10 07:53:04
Message-ID: 20191010075304.GH1852@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 10, 2019 at 02:56:32PM +0900, Amit Langote wrote:
> /*
> * Drops column 'colName' from relation 'rel' and returns the address of the
> * dropped column. The column is also dropped (or marked as no longer
> * inherited from relation) from the relation's inheritance children, if any.
> *
> * In the recursive invocations for inheritance child relations, instead of
> * dropping the column directly (if to be dropped at all), its object address
> * is added to 'addrs', which must be non-NULL in such invocations.
> * All columns are dropped at the same time after all the children have been
> * checked recursively.
> */

Sounds fine to me.

> + * Initialize the location of addresses which will be deleted on a
> + * recursive lookup on children relations. The structure to store all the
> + * object addresses to delete is initialized once when the recursive
> + * lookup begins.
> + */
> + Assert(!recursing || addrs != NULL);
> + if (!recursing)
> + addrs = new_object_addresses();
>
> Maybe this could just say:
>
> /* Initialize addrs on the first invocation. */

I would add "recursive" here, to give:
/* Initialize addrs on the first recursive invocation. */

> + /*
> + * The recursion is ending, hence perform the actual column deletions.
> + */
>
> Maybe:
>
> /* All columns to be dropped must now be in addrs, so drop. */

I think that it would be better to clarify as well that this stands
after all the child relations have been checked, so what about that?
"The resursive lookup for inherited child relations is done. All the
child relations have been scanned and the object addresses of all the
columns to-be-dropped are registered in addrs, so drop."
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-10-10 08:03:16 Re: use of the term "verifier" with SCRAM
Previous Message Masahiko Sawada 2019-10-10 07:47:11 Re: [HACKERS] Block level parallel vacuum