Re: NOT Null constraint on foreign table not working - Mailing list pgsql-hackers

From Tom Lane
Subject Re: NOT Null constraint on foreign table not working
Date
Msg-id 14362.1390231329@sss.pgh.pa.us
Whole thread Raw
In response to NOT Null constraint on foreign table not working  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Responses Re: NOT Null constraint on foreign table not working
Re: NOT Null constraint on foreign table not working
List pgsql-hackers
Rushabh Lathia <rushabh.lathia@gmail.com> writes:
> As per the PG documentation it says that foreign table do support the
> NOT NULL, NULL and DEFAULT.

There has been a great deal of debate about what constraints on foreign
tables ought to mean.  Right now, at least for postgres_fdw, they're just
taken as documentation of constraints that are supposed to exist on the
far side.  It's not clear what's the point of trying to enforce them
against insertions done locally if the remote table lacks them --- any
table update done on the far side could still violate the constraint.

We might change this in response to a well-reasoned argument, but it won't
happen just because somebody lobs a quick-and-dirty patch over the fence.

If we were going to enforce them locally, I'd opine it should be the FDW's
task to do it, anyway.  It might have more knowledge about the best way
to do it than nodeModifyTable.c can, and if not it could still call
ExecConstraints for itself.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Layton
Date:
Subject: Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance
Next
From: Tom Lane
Date:
Subject: Re: ALTER TABLESPACE ... MOVE ALL TO ...