1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-32984 Update federated table and column privileges

mark auto-inc columns for read/write on INSERT,
but only for read on UPDATE
This commit is contained in:
Sergei Golubchik
2023-12-13 21:02:44 +01:00
parent c9902a20b3
commit c4ebf87f86
5 changed files with 75 additions and 6 deletions

View File

@ -7320,7 +7320,7 @@ inline void TABLE::mark_index_columns_for_read(uint index)
always set and sometimes read.
*/
void TABLE::mark_auto_increment_column()
void TABLE::mark_auto_increment_column(bool is_insert)
{
DBUG_ASSERT(found_next_number_field);
/*
@ -7328,7 +7328,8 @@ void TABLE::mark_auto_increment_column()
store() to check overflow of auto_increment values
*/
bitmap_set_bit(read_set, found_next_number_field->field_index);
bitmap_set_bit(write_set, found_next_number_field->field_index);
if (is_insert)
bitmap_set_bit(write_set, found_next_number_field->field_index);
if (s->next_number_keypart)
mark_index_columns_for_read(s->next_number_index);
file->column_bitmaps_signal();
@ -7453,7 +7454,7 @@ void TABLE::mark_columns_needed_for_update()
else
{
if (found_next_number_field)
mark_auto_increment_column();
mark_auto_increment_column(false);
}
if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE)
@ -7527,7 +7528,7 @@ void TABLE::mark_columns_needed_for_insert()
triggers->mark_fields_used(TRG_EVENT_INSERT);
}
if (found_next_number_field)
mark_auto_increment_column();
mark_auto_increment_column(true);
if (default_field)
mark_default_fields_for_write(TRUE);
/* Mark virtual columns for insert */