Re: Questions and experiences writing a Foreign Data Wrapper

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Questions and experiences writing a Foreign Data Wrapper
Дата
Msg-id 18259.1311274844@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Questions and experiences writing a Foreign Data Wrapper  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Ответы Re: Questions and experiences writing a Foreign Data Wrapper
Список pgsql-hackers
"Albe Laurenz" <laurenz.albe@wien.gv.at> writes:
> I wrote a FDW for Oracle to a) learn some server coding
> and b) see how well the FDW API works for me.

> I came up with three questions/experiences:

> 1) GetUserMapping throws an error if there is no
>    user mapping for the user (or PUBLIC).
>    I think that it would be much more useful if
>    it would return NULL or something similar instead.

We could make it do that, but under what circumstances would it be
useful to not throw an error?  It doesn't seem like you should try
to establish a remote connection anyway, if there's no mapping.

> 3) I am confused by the order of function calls
>    during execution of a subplan. It is like this:
>      BeginForeignScan
>      ReScanForeignScan
>      IterateForeignScan
>      IterateForeignScan
>      ...
>      ReScanForeignScan
>      IterateForeignScan
>      IterateForeignScan
>      ...
>      EndForeignScan
>   So the first ReScan is done immediately after
>   BeginForeignScan. Moreover, internal parameters are not
>   set in the BeginForeignScan call.

>   This is probably working as designed, but BeginForeignScan
>   has no way to know whether it should execute a remote
>   query or not.

I'd say it probably shouldn't, ever.  If you look at the executor's node
init functions, none of them do any actual data fetching.  They just
prepare data structures.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: sinval synchronization considered harmful
Следующее
От: Robert Haas
Дата:
Сообщение: Re: sinval synchronization considered harmful