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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers