Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> writes:
> On 2015/05/22 23:50, Tom Lane wrote:
>> So I think worrying about convalidated is pretty pointless.  Really,
>> it is up to the user to determine what constraints should be attached
>> to the foreign table, and IMPORT FOREIGN SCHEMA can't help much.

> Agreed.  So, I'd like to propose to update the docs as above.  Please
> find attached a patch.  The existing sentence "Checking other types of
> constraints is always left to the remote server." sounds to me that
> constraints on foreign tables are enforced locally when updating the
> foreign tables.  So, I'd also like to propose to remove that sentence.
> Maybe I'm missing something though.

Yeah, I agree this documentation is inadequate; but I think it'd be a good
thing to spell out the reason why there's no support for importing check
constraints.  I committed the attached enlarged version.

                        regards, tom lane

diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 1079140..14b12e3 100644
*** a/doc/src/sgml/postgres-fdw.sgml
--- b/doc/src/sgml/postgres-fdw.sgml
***************
*** 309,316 ****
      using <xref linkend="sql-importforeignschema">.  This command creates
      foreign table definitions on the local server that match tables or
      views present on the remote server.  If the remote tables to be imported
!     have columns of user-defined data types, the local server must have types
!     of the same names.
     </para>
  
     <para>
--- 309,316 ----
      using <xref linkend="sql-importforeignschema">.  This command creates
      foreign table definitions on the local server that match tables or
      views present on the remote server.  If the remote tables to be imported
!     have columns of user-defined data types, the local server must have
!     compatible types of the same names.
     </para>
  
     <para>
***************
*** 361,369 ****
  
     <para>
      Note that constraints other than <literal>NOT NULL</> will never be
!     imported from the remote tables, since <productname>PostgreSQL</>
!     does not support any other type of constraint on a foreign table.
!     Checking other types of constraints is always left to the remote server.
     </para>
    </sect3>
   </sect2>
--- 361,376 ----
  
     <para>
      Note that constraints other than <literal>NOT NULL</> will never be
!     imported from the remote tables.  Although <productname>PostgreSQL</>
!     does support <literal>CHECK</> constraints on foreign tables, there is no
!     provision for importing them automatically, because of the risk that a
!     constraint expression could evaluate differently on the local and remote
!     servers.  Any such inconsistency in the behavior of a <literal>CHECK</>
!     constraint could lead to hard-to-detect errors in query optimization.
!     So if you wish to import <literal>CHECK</> constraints, you must do so
!     manually, and you should verify the semantics of each one carefully.
!     For more detail about the treatment of <literal>CHECK</> constraints on
!     foreign tables, see <xref linkend="sql-createforeigntable">.
     </para>
    </sect3>
   </sect2>
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to