EnterpriseDB / mysql_fdw

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

[Feature Support] Add DEFAULT value when INSERT/UPDATE to generated column #241

Open khieuvm opened 2 years ago

khieuvm commented 2 years ago

Original behavior of postgres_fdw: Because the generated column value is handled by the remote server, the local server does not need to assign value to this column -> postgres_fdw sets its value as "DEFAULT".

So currently, we have already implemented this behavior same as postgres_fdw. I would like to contribute them to the repository and community. I will create a pull request to share this feature if you have any interest.

Example explain verbose:

explain (verbose, costs off)
insert into grem1 (a) values (1), (2);
                                             QUERY PLAN                                             
----------------------------------------------------------------------------------------------------
 Insert on public.grem1
   Remote query: INSERT INTO `mysql_fdw_post`.`gloc1_post14`(`id`, `a`, `b`) VALUES (?, ?, DEFAULT)
   ->  Values Scan on "*VALUES*"
         Output: NULL::integer, "*VALUES*".column1, NULL::integer
(5 rows)
surajkharage19 commented 1 year ago

Thanks.

We have added the generated column support in mysql_fdw after your request. Can you please check if that is useful for you and share your feedback? If you are happy with the latest addition, then can you please close the case from your end?