diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/fdwhandler.sgml | 27 | ||||
-rw-r--r-- | doc/src/sgml/postgres-fdw.sgml | 37 |
2 files changed, 64 insertions, 0 deletions
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index 912ca8663ef..6c06f1a4367 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -565,6 +565,33 @@ EndForeignModify (EState *estate, <literal>NULL</>, no action is taken during executor shutdown. </para> + <para> +<programlisting> +int +IsForeignRelUpdatable (Relation rel); +</programlisting> + + Report which update operations the specified foreign table supports. + The return value should be a bitmask of rule event numbers indicating + which operations are supported by the foreign table, using the + <literal>CmdType</> enumeration; that is, + <literal>(1 << CMD_UPDATE) = 4</> for <command>UPDATE</>, + <literal>(1 << CMD_INSERT) = 8</> for <command>INSERT</>, and + <literal>(1 << CMD_DELETE) = 16</> for <command>DELETE</>. + </para> + + <para> + If the <function>IsForeignRelUpdatable</> pointer is set to + <literal>NULL</>, foreign tables are assumed to be insertable, updatable, + or deletable if the FDW provides <function>ExecForeignInsert</>, + <function>ExecForeignUpdate</>, or <function>ExecForeignDelete</> + respectively. This function is only needed if the FDW supports some + tables that are updatable and some that are not. (Even then, it's + permissible to throw an error in the execution routine instead of + checking in this function. However, this function is used to determine + updatability for display in the <literal>information_schema</> views.) + </para> + </sect2> <sect2 id="fdw-callbacks-explain"> diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index a1c3bebb097..35924f19f26 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -254,6 +254,43 @@ </para> </sect3> + + <sect3> + <title>Updatability Options</title> + + <para> + By default all foreign tables using <filename>postgres_fdw</> are assumed + to be updatable. This may be overridden using the following option: + </para> + + <variablelist> + + <varlistentry> + <term><literal>updatable</literal></term> + <listitem> + <para> + This option controls whether <filename>postgres_fdw</> allows foreign + tables to be modified using <command>INSERT</>, <command>UPDATE</> and + <command>DELETE</> commands. It can be specified for a foreign table + or a foreign server. A table-level option overrides a server-level + option. + The default is <literal>true</>. + </para> + + <para> + Of course, if the remote table is not in fact updatable, an error + would occur anyway. Use of this option primarily allows the error to + be thrown locally without querying the remote server. Note however + that the <literal>information_schema</> views will report a + <filename>postgres_fdw</> foreign table to be updatable (or not) + according to the setting of this option, without any check of the + remote server. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect3> </sect2> <sect2> |