Re: ATSimpleRecursion() and inheritance foreign parents

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ATSimpleRecursion() and inheritance foreign parents
Date: 2015-04-28 12:15:27
Message-ID: CA+HiwqGQua=dVnSDjOknwK4210LebKQ9EEtfu5E4b-WMnVxyWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 28, 2015 at 8:45 PM, Etsuro Fujita
<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> On 2015/04/28 15:17, Amit Langote wrote:
>
> Yeah, I think we should now allow the recursion for inheritance parents that
> are foreign tables as well. Attached is a patch for that.
>

Thanks!

>> 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
>>
>> Not sure if the first case could be considered s a bug as foreign tables
>> are
>> pretty lax in these regards anyway.
>
>
> I think the first case would be a bug caused by ATSimpleRecursion() that
> doesn't allow the recursion. But I don't think the second case is a bug.
> As described in the notes in the reference page on ALTER FOREIGN TABLE, I
> think it should be the user's responsibility to ensure that the foreign
> table definition matches the reality.
>

Yeah, I was guessing the first one would be a bug but wasn't quite
sure and the second one is a well-documented behavior for foreign
tables. I just felt that cases covered under ATSimpleRecursion() may
also under fall under that category (being documented); but I guess
not.

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2015-04-28 12:28:54 Re: ATSimpleRecursion() and inheritance foreign parents
Previous Message Robert Haas 2015-04-28 12:11:01 Re: Freeze avoidance of very large table.