Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e70ec82

Browse files
committed
Explain CHECK constraint handling in postgres_fdw's IMPORT FOREIGN SCHEMA.
The existing documentation could easily be misinterpreted, and it failed to explain the inconsistent-evaluation hazard that deterred us from supporting automatic importing of check constraints. Revise it. Etsuro Fujita, further expanded by me
1 parent cdbdc43 commit e70ec82

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

doc/src/sgml/postgres-fdw.sgml

+12-5
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@
309309
using <xref linkend="sql-importforeignschema">. This command creates
310310
foreign table definitions on the local server that match tables or
311311
views present on the remote server. If the remote tables to be imported
312-
have columns of user-defined data types, the local server must have types
313-
of the same names.
312+
have columns of user-defined data types, the local server must have
313+
compatible types of the same names.
314314
</para>
315315

316316
<para>
@@ -361,9 +361,16 @@
361361

362362
<para>
363363
Note that constraints other than <literal>NOT NULL</> will never be
364-
imported from the remote tables, since <productname>PostgreSQL</>
365-
does not support any other type of constraint on a foreign table.
366-
Checking other types of constraints is always left to the remote server.
364+
imported from the remote tables. Although <productname>PostgreSQL</>
365+
does support <literal>CHECK</> constraints on foreign tables, there is no
366+
provision for importing them automatically, because of the risk that a
367+
constraint expression could evaluate differently on the local and remote
368+
servers. Any such inconsistency in the behavior of a <literal>CHECK</>
369+
constraint could lead to hard-to-detect errors in query optimization.
370+
So if you wish to import <literal>CHECK</> constraints, you must do so
371+
manually, and you should verify the semantics of each one carefully.
372+
For more detail about the treatment of <literal>CHECK</> constraints on
373+
foreign tables, see <xref linkend="sql-createforeigntable">.
367374
</para>
368375
</sect3>
369376
</sect2>

0 commit comments

Comments
 (0)