When inserting row into PosgreSQL FOREIGN TABLE I can not use CURRVAL/LASTVAL because these functions should get value from Postgre sequence, but here row is inserted into MySQL backend and the AUTOINCREMENT is changed.
Is there any way to get LASTINSERTID for that field?
(mysql_fdw postgresql extention officially do not support this)
UPD
I have one suggestion to the topic.
To solve this problem it seems the mysql_fdw extention should implement some UDF so I could SELECT MYSQL_FDW_LASTINSERT_ID
which in turn will issue SELECT LAST_INSERT_ID()
to MySQL backend for current session