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

From Albe Laurenz
Subject Re: NOT Null constraint on foreign table not working
Date
Msg-id A737B7A37273E048B164557ADEF4A58B17C915E9@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Re: NOT Null constraint on foreign table not working  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Responses Re: NOT Null constraint on foreign table not working
List pgsql-hackers
Rushabh Lathia wrote:
> I found constraints on foreign table is very useful for the application when the multiple
> user accessing same remote table using fdw and both user want to enforce different
> constraint on particular table or different user want to enforce different DEFAULT
> expression for the same table column.
> 
> I agree with you that if we want to enforce constraint locally then it should be
> FDW's task to do it rather then nodeModifyTable.c.

I believe that a column of a foreign table should be NOT NULL only if
it is guaranteed that it cannot contain NULL values.  Doesn't the planner
rely on that?

But PostgreSQL cannot guarantee that, that has to happen on the remote side
(or in the FDW).  I think that it is best that an error for a constraint
violation is thrown by the same entity that guarantees that the constraint
is respected.

So I agree with your last statement.

Yours,
Laurenz Albe

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Performance Improvement by reducing WAL for Update Operation
Next
From: Heikki Linnakangas
Date:
Subject: Re: proposal: hide application_name from other users