1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-05 01:43:31 +03:00
Commit Graph

8 Commits

Author SHA1 Message Date
Monty
6058e02732 MDEV-37172 Server crashes in Item_func_nextval::update_table after INSERT to the table, that uses expression with nextval() as default
The issue was that unpack_vcol_info_from_frm() wrongly linked the used
sequence tables into tables->internal_tables when more than one sequence
table was used.

Other things:
- Fixed internal_table_exists() to take db into account.
  (This is making the code easier to read. As we where comparing
   pointers the old code also worked).
2025-09-14 19:24:07 +03:00
Sergei Golubchik
18f85c8c68 MDEV-37302 Assertion failure in Table_triggers_list::add_tables_and_routines_for_triggers upon attempt to insert DEFAULT into non-insertable view
Only do trigger prelocking for tables that are doing to be
modified (with a write lock). A table can cause prelocking
if its DEFAULT value is used (because DEFAULT can be NEXTVAL),
even if the table itself is only used for reads. Don't process
triggers for such a table
2025-07-24 00:11:48 +02:00
Sergei Golubchik
1c7685f5fc bugfix: nextval() in default, and UPDATE SET x=DEFAULT
set thd->lex->default_used accordingly
2025-07-09 17:32:37 +02:00
Lena Startseva
9854fb6fa7 MDEV-31003: Second execution for ps-protocol
This patch adds for "--ps-protocol" second execution
of queries "SELECT".
Also in this patch it is added ability to disable/enable
(--disable_ps2_protocol/--enable_ps2_protocol) second
execution for "--ps-prototocol" in testcases.
2023-07-26 17:15:00 +07:00
Daniel Black
8c38939369 MDEV-29540 Incorrect sequence values in INSERT SELECT
The population of default values in INSERT SELECT was being
performed twice. With sequences, this resulted in every
second sequence value being used.

With SELECT INSERT we remove the second invokation of
table->update_default_fields(). This was already performed
in store_values() invoking fill_record_n_invoke_before_triggers()
which invoked update_default_fields() previously.

We do need to return an error on duplicate values, so the
::store_values is extended to take the ignore option.
2022-10-19 08:15:42 +11:00
Michael Widenius
b378ddb3d3 MDEV 22785 Crash with prepared statements and NEXTVAL()
The problem was that a PREARE followed by a non prepared statement
using DEFAULT NEXT_VALUE() could change table->next_local to point to
a not persitent memory aria. The next EXECUTE would then try to use
the wrong pointer, which could cause a crash.
Fixed by reseting the pointer to it's old value when doing EXECUTE.
2021-08-26 07:07:46 +03:00
Monty
36ba58cb75 Fixed that sequences and default works with ps-protocol
The bug was that for prepared statments the new TABLE_LIST was
allocated in the wrong arena.
2018-01-03 02:45:02 +02:00
Monty
9cc7789e90 MDEV 13679 Enabled sequences to be used in DEFAULT
Other changes done to get this to work:
- Added 'internal_tables' to TABLE object to list which sequence tables
  is needed to use the table.
- Mark any expression using DEFAULT() with LEX->default_used.
  This is needed when deciding if we should open internal sequence
  tables when a table is opened (we don't need to open sequence tables
  if the main table is only used with SELECT).
- Create_and_open_temporary_table() can now also open all internal
  sequence tables.
- Added option MYSQL_LOCK_USE_MALLOC to mysql_lock_tables()
  to force memory allocation to be used with malloc instead of
  memroot.
- Added flag to MYSQL_LOCK to remember if allocation was done with
  malloc or memroot (makes code simpler and safer).
- init_one_table_for_prelocking() now takes argument for what lock to
  use instead of it's a routine or something else.
- Renamed prelocking placeholders to make them more understandable as
  they are now used in more code.
- Changed test in check_lock_and_start_stmt() if found table has correct
  locks. The old test didn't work for tables that has lock
  TL_WRITE_ALLOW_WRITE, which is what sequence tables are using.
- Added VCOL_NOT_VIRTUAL option to ensure that sequence functions can't
  be used with virtual columns
- More sequence tests
2017-12-22 14:56:58 +02:00