Here is the test:-- create databasepostgres=# create database foo;CREATE DATABASEpostgres=# \c fooYou are now connected to database "foo" as user "rushabh".-- Create remote table with default expressionfoo=# create table test ( a int , b int default 200 );CREATE TABLEfoo=# \c postgresYou are now connected to database "postgres" as user "rushabh".postgres=# postgres=# create extension postgres_fdw ;CREATE EXTENSION-- Create server and user mappingpostgres=# create server myserver FOREIGN DATA WRAPPER postgres_fdw options (dbname 'foo', port '6666');CREATE SERVERpostgres=# CREATE USER MAPPING FOR CURRENT_USER SERVER myserver;CREATE USER MAPPING-- Import foreign schemapostgres=# import foreign schema public from server myserver into public;IMPORT FOREIGN SCHEMA-- Foreign table got importedpostgres=# \d test Foreign table "public.test" Column | Type | Modifiers | FDW Options --------+---------+-----------+------------------- a | integer | | (column_name 'a') b | integer | | (column_name 'b')Server: myserverFDW Options: (schema_name 'public', table_name 'test')-- Try to insert row and assume that it will add default value for 'b' column postgres=# insert into test (a) values ( 10 );INSERT 0 1-- But guess what, I was wrong ???postgres=# select * from test; a | b ----+--- 10 | (1 row)Looking at the code of postgresImportForeignSchema it clear that its notimporting the default expression from the foreign table. But question is whether it should ?inputs/thoughts ?Regards,Rushabh Lathiawww.EnterpriseDB.com
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных