David Fetter <david@fetter.org> writes:
> On Wed, Mar 14, 2012 at 11:29:14AM -0400, Tom Lane wrote:
>> The posted patch for file_fdw takes the approach of silently
>> filtering out rows for which they're not true, which is not
>> obviously the right thing either --- quite aside from whether that's
>> a sane semantics,
> It clearly is for the author's use case. Other use cases will differ.
You're assuming facts not in evidence. Fujita-san posted that patch not
because he had any use case one way or the other, but because he read
something in fdwhandler.sgml that made him think it was required to
avoid planner malfunctions. (Actually it is not, at the moment, since
we don't do any optimizations based on NOT NULL properties; but we might
in future.) The question on the table is precisely whether believing a
contrary-to-fact NOT NULL assertion would constitute planner malfunction
or user error.
In general, the approach you're sketching towards foreign constraints
seems to me to be 100% overdesign with no basis in known user
requirements. We have a list longer than my arm of things that are
more pressing than doing anything like that.
regards, tom lane