From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Questions and experiences writing a Foreign Data Wrapper |
Date: | 2011-07-20 15:00:15 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C206AB9F6E@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
Otherwise one would have to check for existence
beforehand, which is no less complicated than what
GetUserMapping does.
2) If I decide to close remote database connections after
use, I would like to do so where reasonable.
I would like to keep the connection open between query
planning and query execution and close it when the
scan is done.
The exception could be named prepared statements.
Is there a way to tell if that is the case during
planing or execution?
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 ended up doing that in the first call to
IterateForeignScan because I saw no other way.
That seems a bit unfortunate. Is there an easy way to
change that? If not, it should be documented.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-07-20 15:08:15 | Re: Another issue with invalid XML values |
Previous Message | Robert Haas | 2011-07-20 14:54:31 | Re: [v9.1] sepgsql - userspace access vector cache |