Re: ATSimpleRecursion() and inheritance foreign parents

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: ATSimpleRecursion() and inheritance foreign parents
Дата
Msg-id 20150428122854.GA31463@fetter.org
обсуждение исходный текст
Ответ на ATSimpleRecursion() and inheritance foreign parents  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Ответы Re: ATSimpleRecursion() and inheritance foreign parents  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
On Tue, Apr 28, 2015 at 03:17:08PM +0900, Amit Langote wrote:
> 
> Hi,
> 
> Following ALTER TABLE actions are applied recursively to inheritance
> descendents via ATSimpleRecursion() -
> 
> ALTER COLUMN DEFAULT
> ALTER COLUMN DROP NOT NULL
> ALTER COLUMN SET NOT NULL
> ALTER COLUMN SET STATISTICS
> ALTER COLUMN SET STORAGE
> 
> The code at the beginning of ATSimpleRecursion() looks like -
> 
> /*
>  * Propagate to children if desired.  Non-table relations never have
>  * children, so no need to search in that case.
>  */
>  if (recurse && rel->rd_rel->relkind == RELKIND_RELATION)
> 
> Not sure if it's great idea, but now that foreign tables can also have
> children, should above be changed to take that into account? Any inheritance
> related recursion performed without using ATSimpleRecursion() recurse as
> dictated by RangeVar.inhOpt; so even foreign inheritance parents expand for
> various ALTER TABLE actions like adding a column though that is not a
> meaningful operation on foreign tables anyway.
> 
> An example,
> postgres=# alter foreign table fparent alter a type char;
> ALTER FOREIGN TABLE
> 
> postgres=# select * from fparent;
> ERROR:  attribute "a" of relation "fchild1" does not match parent's type
> 
> Above error, AIUI, is hit much before it is determined that fparent is a
> foreign table, whereas the following is FDW-specific (waiting to happen) error,
> 
> postgres=# alter foreign table fparent add b char;
> ALTER FOREIGN TABLE
> 
> postgres=# SELECT * FROM fparent;
> ERROR:  column "b" does not exist
> CONTEXT:  Remote SQL command: SELECT a, b FROM public.parent

I'm pretty sure this is a bug.  The way I see it, foreign tables can
either fully participate in table inheritance, or not at all, because
any inconsistencies here will cause confusion at best.

How big a deal would it be to fix it?

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: ATSimpleRecursion() and inheritance foreign parents
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Improving vacuum/VM/etc