mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 10:57:54 +02:00
Bug #39002: The server crashes on the query:
INSERT .. SELECT .. ON DUPLICATE KEY UPDATE col=DEFAULT In order to get correct values from update fields that belongs to the SELECT part in the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE statement, the server adds referenced fields to the select list. Part of the code that does this transformation is shared between implementations of the DEFAULT(col) function and the DEFAULT keyword (in the col=DEFAULT expression), and an implementation of the DEFAULT keyword is incomplete. mysql-test/r/default.result: Added test case for bug #39002. mysql-test/t/default.test: Added test case for bug #39002. sql/item.cc: The Item_default_value::transform() function has been modified to take into account the fact that the DEFAULT keyword has no arguments unlike the DEFAULT(col) function that always has an argument.
This commit is contained in:
parent
88d66418c8
commit
59b9d50c8a
3 changed files with 41 additions and 0 deletions
|
|
@ -6039,6 +6039,13 @@ Item *Item_default_value::transform(Item_transformer transformer, byte *args)
|
|||
{
|
||||
DBUG_ASSERT(!current_thd->is_stmt_prepare());
|
||||
|
||||
/*
|
||||
If the value of arg is NULL, then this object represents a constant,
|
||||
so further transformation is unnecessary (and impossible).
|
||||
*/
|
||||
if (!arg)
|
||||
return 0;
|
||||
|
||||
Item *new_item= arg->transform(transformer, args);
|
||||
if (!new_item)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue