On Mon, Jan 20, 2014 at 8:52 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Rushabh Lathia <rushabh.lat...@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.

What is the reason for keeping DEFAULT behaviour different than
constraints. Right now the behaviour for DEFAULT is if it is
defined on foreign table, then it will use that even if original table has
different or no default value?

Create Database foo;
\c foo
create table tbl(c1 int Default 20);

\c postgres
create foreign table tbl(c1 int Default 10) server pgdbfdw; --here
pgdbfdw is server for postgres_fdw
insert into tbl values(Default);
select * from tbl;
 c1
----
 10
(1 row)

\c foo
insert into tbl values(Default);
select * from tbl;
 c1
----
 10
 20
(2 rows)


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to