Tom Lane wrote:
>> 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.
I guess I misunderstood the concept of user mapping.
I assumed that the user of the mapping is the table owner and
the mapping provides default values for all foreign tables
the user owns.
Does it refer to the user that executes a query?
Or is a user mapping intended to be the only source of
connection information?
I guess it is time to read my SQL Standard, but some clarification
in the documentation sure wouldn't hurt.
>> 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.
That might also be a good thing to document.
Yours,
Laurenz Albe