EnterpriseDB / mysql_fdw

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

Support RETURNING on mariadb > 10.5 #258

Open wpichler opened 1 year ago

wpichler commented 1 year ago

Hi all,

MariaDB > 10.5 does support RETURNING now.

https://mariadb.com/kb/en/insertreturning/

I'd like to add this feature to mysql_fdw - but without knowing the fdw sources / postgres internals it is hard to handle.

This is Work in Progress - maybe someone has already done this - also working on it ?

Currently i do get a cache lookup error on the columns translate - i think i am using it not correct.

surajkharage19 commented 1 year ago

Thanks for the pull request.

As you mentioned above, RETURNING clause might be working in MariaDB >10.5 but not in MySQL. So the changes will be complicated even if we try to implement only for MariaDB as mysql_fdw supports both. Currently, this is not on our roadmap but if you have a working patch ready for the same, we will be happy to review and take it further. From the pull request that you submitted, I can see code changes but I don't think those are considered for MySQL as well.

wpichler commented 1 year ago

The current PR is just a starting point - far from complete. For the real implementation i would implement a query to get the server type (mysql / mariadb) and version. And depending on the version the returning is then available or not.

mkgrgis commented 1 year ago

@wpichler , there is version functions and full RETURNING support in firebird_fdw. You can read the interesting realisation from @ibarwick.