EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
521 stars 160 forks source link

Support generated columns on foreign table #247

Open MinhLA1410 opened 2 years ago

MinhLA1410 commented 2 years ago

Currently, we already implement to support generated columns on foreign table like postgres_fdw. I would like to contribute them into repository and community. If you have interest? I will create pull request for share this feature.

Summary modification:

Reference testcase of postgres_fdw.sql in postgres_fdw:

create foreign table grem1 (
  id int,
  a int,
  b int generated always as (a * 2) stored)
  server mysql_svr options(dbname 'mysql_fdw_post', table_name 'gloc1');

insert into grem1 (a) values (1), (2);

update grem1 set a = 22 where a = 2;

select a, b from grem1;
 a  | b  
----+----
  1 |  2
 22 | 44
(2 rows)