Re: NOT Null constraint on foreign table not working
От | Rushabh Lathia |
---|---|
Тема | Re: NOT Null constraint on foreign table not working |
Дата | |
Msg-id | CAGPqQf2i+biuPxcaoabA2h-ykL_49ycj28OhwOec9iGNi+zWpA@mail.gmail.com обсуждение исходный текст |
Ответ на | NOT Null constraint on foreign table not working (Rushabh Lathia <rushabh.lathia@gmail.com>) |
Список | pgsql-hackers |
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 <rushabh.lathia@gmail.com> wrote:
Hello,Please consider the following test:create database foo;\c foocreate table foo_test ( a int );\c postgrescreate 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_server;create foreign table foo_test ( a int not null) server foo_server;-- insert should return error for because NOT NULL constraint on column apostgres=# insert into foo_test values ( null );INSERT 0 1postgres=# select * from foo_test;a---(1 row)-- clean updrop foreign table foo_test;drop server foo_server cascade;\c postgresdrop database foo;Analysis:As per the PG documentation it says that foreign table do support theNOT NULL, NULL and DEFAULT.But when I tried the NOT NULL constraint, its not working for the foreign tables.Looking at the code into ExecInsert(), for the foreign table missed to callExecConstraints(). I am not sure whether it is intentional that we not callingExecConstraints() in case of foreign server or its missed.Do share your thought on this.I quickly fix the issue by adding ExecConstraints() call for foreign table andnow test behaving as expected. PFA patch for the same.Regards,Rushabh Lathia
Rushabh Lathia
Вложения
В списке pgsql-hackers по дате отправления: