mysql_fdw icon indicating copy to clipboard operation
mysql_fdw copied to clipboard

Support Truncate like postgres_fdw of postgresql-14

Open MinhLA1410 opened this issue 2 years ago • 1 comments

Currently, we already implement Truncate like postgres_fdw from postgresql-14. 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:

  • Only support the basic truncate statement TRUNCATE [TABLE] tbl_name.
  • Add function: mysql_deparse_truncate_sql()
  • Add foreign routine: mysqlExecForeignTruncate()

Reference testcase of postgres_fdw.sql in postgres_fdw:

-- Before
ALTER SERVER mysql_svr OPTIONS (ADD truncatable 'false');
TRUNCATE tru_ftable;			-- error
ERROR:  foreign table "tru_ftable" does not allow truncates

-- After
ALTER FOREIGN TABLE tru_ftable OPTIONS (ADD truncatable 'true');
TRUNCATE tru_ftable;

MinhLA1410 avatar Mar 29 '22 10:03 MinhLA1410

Thanks.

We have added the truncate 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?

surajkharage19 avatar Aug 05 '22 02:08 surajkharage19