Josh Berkus <josh@agliodbs.com> wrote:
> It would be really good to have access to the scan criteria as text, a
> hash, or other generally manipulable data structures, as well, for
> foreign data which is not SQL-based.
We can provide such formatter functions as options. In fact, the present
postgresql_fdw uses deparse_context_for_plan() and deparse_expression()
exported from the core. However, I think the conversion should be
performed in each FDW because some of FDW don't necessary need the
criteria. For example, CSV-FDW will just return the all of the contents
as tuples, and the common executor routine will filter and modify them.
> Finally, if you are making the scan more visible, a nice side effect of
> this would be the ability to log all the scan criteria on a particular
> table (whether its an FDW or not); it would help a lot with indexing.
We might need to provide more useful deparse_xxx() functions for general
uses. For example, oracle_fdw also requires deparsing criteria to a SQL.
It would be almost the same as PostgreSQL, but also require to remap
incompatible functions and expressions in their preferred ways.
Regards,
---
Takahiro Itagaki
NTT Open Source Software Center