Skip to content

Commit c2b51cf

Browse files
committed
Improve documentation about usage of FDW validator functions.
SGML documentation, as well as code comments, failed to note that an FDW's validator will be applied to foreign-table options for foreign tables using the FDW. Etsuro Fujita
1 parent 438df52 commit c2b51cf

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

doc/src/sgml/ref/alter_foreign_data_wrapper.sgml

+7-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> REN
9191
</para>
9292

9393
<para>
94-
Note that it is possible that after changing the validator the
95-
options to the foreign-data wrapper, servers, and user mappings
96-
have become invalid. It is up to the user to make sure that
97-
these options are correct before using the foreign-data
98-
wrapper.
94+
Note that it is possible that pre-existing options of the foreign-data
95+
wrapper, or of dependent servers, user mappings, or foreign tables, are
96+
invalid according to the new validator. <productname>PostgreSQL</> does
97+
not check for this. It is up to the user to make sure that these
98+
options are correct before using the modified foreign-data wrapper.
99+
However, any options specified in this <command>ALTER FOREIGN DATA
100+
WRAPPER</> command will be checked using the new validator.
99101
</para>
100102
</listitem>
101103
</varlistentry>

doc/src/sgml/ref/create_foreign_data_wrapper.sgml

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ CREATE FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
8080
<varlistentry>
8181
<term><literal>VALIDATOR <replaceable class="parameter">validator_function</replaceable></literal></term>
8282
<listitem>
83-
<para><replaceable class="parameter">validator_function</replaceable> is the
84-
name of a previously registered function that will be called to
83+
<para><replaceable class="parameter">validator_function</replaceable>
84+
is the name of a previously registered function that will be called to
8585
check the generic options given to the foreign-data wrapper, as
86-
well as options for foreign servers and user mappings using the
87-
foreign-data wrapper. If no validator function or <literal>NO
86+
well as options for foreign servers, user mappings and foreign tables
87+
using the foreign-data wrapper. If no validator function or <literal>NO
8888
VALIDATOR</literal> is specified, then options will not be
8989
checked at creation time. (Foreign-data wrappers will possibly
9090
ignore or reject invalid option specifications at run time,

src/backend/commands/foreigncmds.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
/*
4141
* Convert a DefElem list to the text array format that is used in
42-
* pg_foreign_data_wrapper, pg_foreign_server, and pg_user_mapping.
42+
* pg_foreign_data_wrapper, pg_foreign_server, pg_user_mapping, and
43+
* pg_foreign_table.
44+
*
4345
* Returns the array in the form of a Datum, or PointerGetDatum(NULL)
4446
* if the list is empty.
4547
*
@@ -88,7 +90,8 @@ optionListToArray(List *options)
8890
* Returns the array in the form of a Datum, or PointerGetDatum(NULL)
8991
* if the list is empty.
9092
*
91-
* This is used by CREATE/ALTER of FOREIGN DATA WRAPPER/SERVER/USER MAPPING.
93+
* This is used by CREATE/ALTER of FOREIGN DATA WRAPPER/SERVER/USER MAPPING/
94+
* FOREIGN TABLE.
9295
*/
9396
Datum
9497
transformGenericOptions(Oid catalogId,
@@ -681,8 +684,9 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
681684
repl_repl[Anum_pg_foreign_data_wrapper_fdwvalidator - 1] = true;
682685

683686
/*
684-
* It could be that the options for the FDW, SERVER and USER MAPPING
685-
* are no longer valid with the new validator. Warn about this.
687+
* It could be that existing options for the FDW or dependent SERVER,
688+
* USER MAPPING or FOREIGN TABLE objects are no longer valid according
689+
* to the new validator. Warn about this.
686690
*/
687691
if (OidIsValid(fdwvalidator))
688692
ereport(WARNING,

0 commit comments

Comments
 (0)