ifsnop / mysqldump-php

PHP version of mysqldump cli that comes with MySQL
https://github.com/ifsnop/mysqldump-php
GNU General Public License v3.0
1.25k stars 300 forks source link

Dumping events is not skipping definer #276

Open lugb2 opened 9 months ago

lugb2 commented 9 months ago

We need to skip the definer information when dumping triggers, functions and events. But, when set 'events' to 'true' for event structure, it doesn't skip the definer. We found a solution by adjusting the regex in the function that creates events and made a pr with the fix (#274). We are also opening an issue to provide a clearer explanation. We hope this will be addressed soon.

Thanks!

ifsnop commented 2 months ago

Thanks for your contribution, could you provide a test, so I can check the new regex does what is meant to do?

lugb2 commented 2 months ago

You're welcome! I reviewed the existing tests, and test012 closely resembles mine, but there was no event creation in the SQL. I edited the test012.src.sql file by adding a simple CREATE EVENT. When tested with the adjusted regex, the definer is correctly skipped; otherwise, it is still being set in the CREATE EVENT statement.

I noticed that test012 also deals with the definer, but it may not have caught the issue earlier because there was no event. With this change, I hope the test will now work as expected. Please let me know if you'd like further adjustments!