On Fri, Sep 18, 2026 at 5:25 PM PG Bug reporting form
<noreply@postgresql.org> wrote:
> Description
> -----------
> When IMPORT FOREIGN SCHEMA imports a remote table having a NOT NULL
> constraint declared NOT VALID, postgres_fdw creates trusted local NOT NULL
> metadata. The remote table can still contain NULL values because its
> constraint has not been validated. With constraint_exclusion enabled,
> PostgreSQL relies on the imported metadata and incorrectly excludes a query
> that would find such a row. Queries through the imported foreign table can
> therefore silently omit existing rows.
For the reported case, I think we should set the import_not_null
option for IMPORT FOREIGN SCHEMA to false. That option is enabled by
default, but should be disabled if it isn't ensured that the remote
table never has NULL.
Best regards,
Etsuro Fujita