[MDEV-29090] mysqldump --system=users might be better with CREATE USER IF NOT EXISTS Created: 2022-07-12 Updated: 2022-08-15 Resolved: 2022-08-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.6.7 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Bruce Kirkpatrick | Assignee: | Daniel Black |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is the command I'm using: Can you evaluate whether including IF NOT EXISTS on the CREATE USER statements might be better? I learned I can use the "-f" option on mysql command to workaround the problem which allows it to skip the errors. Thought I'd share this since I was stuck and confused about how to do it for a while. |
| Comments |
| Comment by Daniel Black [ 2022-07-12 ] |
|
The --insert-ignore with --system=X will generate CREATE USER IF NOT EXISTS SQL output. --replace will generate CREATE OR REPLACE USER output. The --system=stats tables take on REPLACE INTO as a default, so something similar here could be done. MDEV-25537 needs to be fixed related to enact a default of CREATE OR REPLACE. If a --force option is used the self protection this should avoid CREATE OR REPLACE USER on the currently user loading the database. Would a CREATE USER IF NOT EXISTS default look inconsistent with a stats/timezones being a REPLACE INTO? Should other --system=X take on a default IF NOT EXISTS or OR REPLACE option too? I agree that without --insert-ignore or --replace that --system= output is a bit fragile when importing. |
| Comment by Bruce Kirkpatrick [ 2022-07-12 ] |
|
Thank you for mentioning --insert-ignore. I will use that. |
| Comment by Daniel Black [ 2022-07-12 ] |
|
Sure, happy to consider a default behaviour if requested. It will just need to ruggedize some other behaviours, like make CREATE OR REPLACE `currentuser` to not break the current session on import. |