Re: [HACKERS] pg_attribute.attisinherited ? - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: [HACKERS] pg_attribute.attisinherited ?
Date
Msg-id Pine.LNX.4.44.0208261634480.15217-200000@cm-lcon1-46-187.cm.vtr.net
Whole thread Raw
In response to Re: [HACKERS] pg_attribute.attisinherited ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] pg_attribute.attisinherited ?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: [HACKERS] pg_attribute.attisinherited ?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Tom Lane dijo:

> Alvaro Herrera <alvherre@atentus.com> writes:
> > I'm thinking about the ONLY part in the grammar in ALTER TABLE... DROP
> > COLUMN and RENAME COLUMN.  I think they should not be there:
>
> Local DROP COLUMN is fine: it just causes the column to become
> non-inherited in any children.  (Your patch for attisinherited will
> need to cover this case.)

Oh, I see.

> Local RENAME COLUMN does need to be prohibited, as does local ADD
> COLUMN, as does local ALTER COLUMN if we ever allow changing column
> type.  Basically we need to prohibit the column from becoming
> incompatible with its children.

> I don't agree with the notion of changing the grammar to achieve that,
> btw.  Simpler and more friendly to add a specific error check in
> (most likely place) utility/tcop.c.  Then if you try to say ONLY you'll
> get a more useful complaint than "parse error".

Uh, I added checks in the command itself (command/tablecmds.c), just
because I had already done so and to not make tcop/utility.c messier
than it already is; I can probably move the check if people thinks it's
better.  Also implemented is the change from inherited to non-inherited
when local-dropping a column.

I also changed the text of some error messages from "renameatt: cannot
foo" to "ALTER TABLE: cannot foo".  But my choose in wording of new
error messages probably needs improvement (suggestions welcome).

Please review; I have not received comments on whether this
implementation is a good approach: note the signature change of
TupleDescInitEntry().

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"La espina, desde que nace, ya pincha" (Proverbio africano)

Attachment

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: revised patch for PL/PgSQL table functions
Next
From: Tom Lane
Date:
Subject: Re: revised patch for PL/PgSQL table functions