in the <literal>areq</literal>.
</para>
<para>
<programlisting>
void
ForeignAsyncConfigureWait(AsyncRequest *areq);
</programlisting>
Configure a file descriptor event for which the
<structname>ForeignScan</structname> node wishes to wait.
This function will only be called when the
<structname>ForeignScan</structname> node has the
<literal>areq->callback_pending</literal> flag set, and should add
the event to the <structfield>as_eventset</structfield> of the parent
<structname>Append</structname> node described by the
<literal>areq</literal>. See the comments for
<function>ExecAsyncConfigureWait</function> in
<filename>src/backend/executor/execAsync.c</filename> for additional
information. When the file descriptor event occurs,
<function>ForeignAsyncNotify</function> will be called.
</para>
<para>
<programlisting>
void
ForeignAsyncNotify(AsyncRequest *areq);
</programlisting>
Process a relevant event that has occurred, then produce one tuple
asynchronously from the <structname>ForeignScan</structname> node.
This function should set the output parameters in the
<literal>areq</literal> in the same way as
<function>ForeignAsyncRequest</function>.
</para>
</sect2>
<sect2 id="fdw-callbacks-reparameterize-paths">
<title>FDW Routines for Reparameterization of Paths</title>
<para>
<programlisting>
List *
ReparameterizeForeignPathByChild(PlannerInfo *root, List *fdw_private,
RelOptInfo *child_rel);
</programlisting>
This function is called while converting a path parameterized by the
top-most parent of the given child relation <literal>child_rel</literal> to be
parameterized by the child relation. The function is used to reparameterize
any paths or translate any expression nodes saved in the given
<literal>fdw_private</literal> member of a <structname>ForeignPath</structname>. The
callback may use <literal>reparameterize_path_by_child</literal>,
<literal>adjust_appendrel_attrs</literal> or
<literal>adjust_appendrel_attrs_multilevel</literal> as required.
</para>
</sect2>
</sect1>
<sect1 id="fdw-helpers">
<title>Foreign Data Wrapper Helper Functions</title>
<para>
Several helper functions are exported from the core server so that
authors of foreign data wrappers can get easy access to attributes of
FDW-related objects, such as FDW options.
To use any of these functions, you need to include the header file
<filename>foreign/foreign.h</filename> in your source file.
That header also defines the struct types that are returned by
these functions.
</para>
<para>
<programlisting>
ForeignDataWrapper *
GetForeignDataWrapperExtended(Oid fdwid, bits16 flags);
</programlisting>
This function returns a <structname>ForeignDataWrapper</structname>
object for the foreign-data wrapper with the given OID. A
<structname>ForeignDataWrapper</structname> object contains properties
of the FDW (see <filename>foreign/foreign.h</filename> for details).
<structfield>flags</structfield> is a bitwise-or'd bit mask indicating
an extra set of options. It can take the value
<literal>FDW_MISSING_OK</literal>, in which case a <literal>NULL</literal>
result is returned to the caller instead of an error for an undefined
object.
</para>
<para>
<programlisting>
ForeignDataWrapper *
GetForeignDataWrapper(Oid fdwid);
</programlisting>
This function returns a <structname>ForeignDataWrapper</structname>
object for the foreign-data wrapper with the given OID. A
<structname>ForeignDataWrapper</structname> object contains properties
of the FDW (see <filename>foreign/foreign.h</filename> for details).
</para>
<para>
<programlisting>
ForeignServer *
GetForeignServerExtended(Oid serverid, bits16 flags);
</programlisting>
This function