EnterpriseDB / mysql_fdw

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

Support Direct modification #243

Open MinhLA1410 opened 2 years ago

MinhLA1410 commented 2 years ago

Currently, we already Support Direct modification postgres_fdw for mysql_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:

EXPLAIN (verbose, costs off)
UPDATE ft2 SET c2 = c2 + 300, c3 = c3 || '_update3' WHERE c1 % 10 = 3;              -- can be pushed down
                                                                QUERY PLAN                                                                
------------------------------------------------------------------------------------------------------------------------------------------
 Update on public.ft2
   ->  Foreign Update on public.ft2
         remote query: UPDATE `mysql_fdw_post`.`T 1` SET `c2` = (`c2` + 300), `c3` = CONCAT(`c3` , '_update3') WHERE (((`C 1` % 10) = 3))
(3 rows)

EXPLAIN (verbose, costs off)
DELETE FROM ft2 USING ft1 WHERE ft1.c1 = ft2.c2 AND ft1.c1 % 10 = 2;                -- can be pushed down
                                                                             QUERY PLAN                                                                              
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Delete on public.ft2
   ->  Foreign Delete
         remote query: DELETE FROM  r1 USING `mysql_fdw_post`.`T 1` r1 INNER JOIN `mysql_fdw_post`.`T 1` r2 WHERE ((r1.`c2` = r2.`C 1`)) AND (((r2.`C 1` % 10) = 2))
(3 rows)