On Tue, Apr 28, 2015 at 8:45 PM, Etsuro Fujita
<fujita.etsuro@lab.ntt.co.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