Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-21 Thread Tom Lane
Albe Laurenz writes: > 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? The planner does expect that constraints tell the truth. I don't remember how significant a false NOT NULL cons

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-21 Thread Albe Laurenz
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 > expr

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-20 Thread Rushabh Lathia
On Mon, Jan 20, 2014 at 8:52 PM, Tom Lane wrote: > Rushabh Lathia 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 l

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-20 Thread Amit Kapila
On Tue, Jan 21, 2014 at 9:32 AM, Tom Lane wrote: > Amit Kapila writes: >> On Mon, Jan 20, 2014 at 8:52 PM, Tom Lane wrote: >>> There has been a great deal of debate about what constraints on foreign >>> tables ought to mean. > >> What is the reason for keeping DEFAULT behaviour different than >>

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-20 Thread Tom Lane
Amit Kapila writes: > On Mon, Jan 20, 2014 at 8:52 PM, Tom Lane wrote: >> There has been a great deal of debate about what constraints on foreign >> tables ought to mean. > What is the reason for keeping DEFAULT behaviour different than > constraints. Right now the behaviour for DEFAULT is if it

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-20 Thread Amit Kapila
On Mon, Jan 20, 2014 at 8:52 PM, Tom Lane wrote: > Rushabh Lathia 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 leas

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-20 Thread Tom Lane
Rushabh Lathia 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

Re: [HACKERS] NOT Null constraint on foreign table not working

2014-01-19 Thread Rushabh Lathia
Please consider attached patch here as earlier attached wrong patch. Sorry for the inconvenience. On Mon, Jan 20, 2014 at 1:21 PM, Rushabh Lathia wrote: > Hello, > > Please consider the following test: > > create database foo; > \c foo > > create table foo_test ( a int ); > > \c postgres > > cr

[HACKERS] NOT Null constraint on foreign table not working

2014-01-19 Thread Rushabh Lathia
Hello, Please consider the following test: create database foo; \c foo create table foo_test ( a int ); \c postgres create extension if not exists postgres_fdw; create server foo_server foreign data wrapper postgres_fdw options ( dbname 'foo' ); create user mapping for current_user server foo