Open francoisp opened 4 years ago
Thanks, @francoisp for reporting this. I am able to reproduce the issue at my end. Your changes look good to me, however, I see concerns with respect to row identifier column.
1: If we try to update the row identifier column through BRU trigger then it is not reflecting as new value. Except for that column, all other columns are updated as per their new value assigned in BRU trigger.
2: If we try to update the row identifier column through an update statement (considering that table has BRU trigger) then it is NOT throwing an error, nor updating any of the remaining columns. e.g: update mysql_insert_test set c1=100, id =10 where id=3;
In above statement, id is a row identifier column.
For point 1, we can check if the row identifier column value has been changed by before row trigger then we can throw an error by comparing it with old value.
For point 2, throw an error when we find row identifier column in the target list considering that table has before row update trigger. For this, we need to search row identifier column in rte->updatedCols.
I have done these changes in the attached patch, please let me know your feedback.
@surajkharage19 Very good points! Sorry for the slow reply, I missed this particular message. This does look like fine solutions to these cases, I'll report shortly, I think this covers all angles. Thanks for looking into this.
I've updated the PR
I've created an new clean pull request
bug fix (and test) to send whole row on update when there's a before trigger. (weird had to manually create tables in mysql create foreign table does not create a table in mysql?) tested with pg11 and mysql 5.7