Thanks for the review.

(2011/06/12 13:21), Robert Haas wrote:
> 2011/6/9 Shigeru Hanada<han...@metrosystems.co.jp>:
>> Attached patch includes fixes for FOREIGN TABLE documents:
> 
> I committed the changes to ALTER FOREIGN TABLE, but I think the
> changes to CREATE FOREIGN TABLE need more thought.  The first of the
> two hunks you've proposed to add doesn't seem necessary to me, and the
> second one seems like it belongs in a chapter on how to write a
> foreign data wrapper correctly, rather than here.

Agreed.  How about the section for IterateForeignScan() in "50.1.
Foreign Data Wrapper Callback Routines"[1] for the second hunk?  It
seems proper place to describe responsibility about applying NOT NULL
constraint, because it would be where the author works for the issue.
The section also mentions responsibility of column signature matching.

By the way, I found another document issue. "5.10. Foreign Data"[2] says
that FDW for PG is available alike FDW for files, but postgresql_fdw
won't be available for 9.1 release, at least as a bundled extension.
ISTM that such mention should be removed to avoid misunderstanding.

Please find attached the revised patch.

[1] http://developer.postgresql.org/pgdocs/postgres/fdw-routines.html
[2] http://developer.postgresql.org/pgdocs/postgres/ddl-foreign-data.html

Regards,
-- 
Shigeru Hanada
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 9709dd6..09d7a24 100644
*** a/doc/src/sgml/ddl.sgml
--- b/doc/src/sgml/ddl.sgml
*************** ANALYZE measurement;
*** 3021,3030 ****
      <firstterm>foreign data wrapper</firstterm>. A foreign data wrapper is a
      library that can communicate with an external data source, hiding the
      details of connecting to the data source and fetching data from it. There
!     are several foreign data wrappers available, which can for example read
!     plain data files residing on the server, or connect to another PostgreSQL
!     instance. If none of the existing foreign data wrappers suit your needs,
!     you can write your own; see <xref linkend="fdwhandler">.
     </para>
  
     <para>
--- 3021,3031 ----
      <firstterm>foreign data wrapper</firstterm>. A foreign data wrapper is a
      library that can communicate with an external data source, hiding the
      details of connecting to the data source and fetching data from it. There
!     is a foreign data wrapper available as a <file>contrib</file> module,
!     which can read plain data files residing on the server.  Other kind of
!     foreign data wrappers might be found as third party products.  If none of
!     the existing foreign data wrappers suit your needs, you can write your
!     own; see <xref linkend="fdwhandler">.
     </para>
  
     <para>
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml
index fc07f12..f1318d7 100644
*** a/doc/src/sgml/fdwhandler.sgml
--- b/doc/src/sgml/fdwhandler.sgml
*************** IterateForeignScan (ForeignScanState *no
*** 180,185 ****
--- 180,193 ----
      </para>
  
      <para>
+      Note that <productname>PostgreSQL</productname>'s executor doesn't care
+      whether the rows returned violate the NOT NULL constraints which were
+      defined on the foreign table columns.  If you want to make the FDW that
+      enforce NOT NULL constraints, you need to raise an error when a result
+      data fetched from the foreign source violates the constraint.
+     </para>
+ 
+     <para>
  <programlisting>
  void
  ReScanForeignScan (ForeignScanState *node);
-- 
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