mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
Merge branch '10.4' into 10.5
This commit is contained in:
commit
4cda50afbd
5 changed files with 123 additions and 5 deletions
|
@ -5929,5 +5929,55 @@ a b
|
||||||
2 30
|
2 30
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
#
|
#
|
||||||
|
# MDEV-33549: Incorrect handling of UPDATE in PS mode in case a table's colum declared as NOT NULL
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT NULL);
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1 SET b=?' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
20 NULL
|
||||||
|
# Run twice the same update in PS mode to check
|
||||||
|
# that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1 SET b=?';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
# Clean up
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
# The same test for multi-table update
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT NULL);
|
||||||
|
CREATE TABLE t2 (a INT, c INT DEFAULT NULL);
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
INSERT INTO t2 VALUES (20, 30);
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
20 NULL
|
||||||
|
# Run twice the same multi-table update in PS mode to check
|
||||||
|
# that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
# Clean up
|
||||||
|
DROP TABLE t1;
|
||||||
|
# This time checks that a default value for table's column
|
||||||
|
# represented by a function call is handled correctly on UPDATE in PS mode
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT MOD(a, 3));
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
20 2
|
||||||
|
# Run twice the same multi-table update in PS mode to check
|
||||||
|
# that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
# Clean up
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
#
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
|
|
@ -5362,6 +5362,60 @@ SELECT * FROM t2;
|
||||||
# Cleanup
|
# Cleanup
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-33549: Incorrect handling of UPDATE in PS mode in case a table's colum declared as NOT NULL
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT NULL);
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1 SET b=?' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Run twice the same update in PS mode to check
|
||||||
|
--echo # that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1 SET b=?';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
|
||||||
|
--echo # Clean up
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # The same test for multi-table update
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT NULL);
|
||||||
|
CREATE TABLE t2 (a INT, c INT DEFAULT NULL);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
INSERT INTO t2 VALUES (20, 30);
|
||||||
|
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
--echo # Run twice the same multi-table update in PS mode to check
|
||||||
|
--echo # that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
--echo # Clean up
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # This time checks that a default value for table's column
|
||||||
|
--echo # represented by a function call is handled correctly on UPDATE in PS mode
|
||||||
|
CREATE TABLE t1 (a INT, b INT DEFAULT MOD(a, 3));
|
||||||
|
INSERT INTO t1 VALUES (20, 30);
|
||||||
|
EXECUTE IMMEDIATE 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Run twice the same multi-table update in PS mode to check
|
||||||
|
--echo # that no memory relating issues taken place.
|
||||||
|
PREPARE stmt FROM 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a';
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
EXECUTE stmt USING DEFAULT;
|
||||||
|
|
||||||
|
--echo # Clean up
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
16
sql/item.cc
16
sql/item.cc
|
@ -5131,9 +5131,19 @@ bool Item_param::assign_default(Field *field)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_default_field->default_value)
|
if (m_default_field->default_value)
|
||||||
m_default_field->set_default();
|
{
|
||||||
|
return m_default_field->default_value->expr->save_in_field(field, 0);
|
||||||
return field_conv(field, m_default_field);
|
}
|
||||||
|
else if (m_default_field->is_null())
|
||||||
|
{
|
||||||
|
field->set_null();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field->set_notnull();
|
||||||
|
return field_conv(field, m_default_field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3995,6 +3995,12 @@ public:
|
||||||
Item_param(THD *thd, const LEX_CSTRING *name_arg,
|
Item_param(THD *thd, const LEX_CSTRING *name_arg,
|
||||||
uint pos_in_query_arg, uint len_in_query_arg);
|
uint pos_in_query_arg, uint len_in_query_arg);
|
||||||
|
|
||||||
|
void cleanup() override
|
||||||
|
{
|
||||||
|
m_default_field= NULL;
|
||||||
|
Item::cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
Type type() const override
|
Type type() const override
|
||||||
{
|
{
|
||||||
// Don't pretend to be a constant unless value for this item is set.
|
// Don't pretend to be a constant unless value for this item is set.
|
||||||
|
|
|
@ -2955,7 +2955,6 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
int sig;
|
int sig;
|
||||||
my_thread_init(); // Init new thread
|
my_thread_init(); // Init new thread
|
||||||
DBUG_ENTER("signal_hand");
|
|
||||||
signal_thread_in_use= 1;
|
signal_thread_in_use= 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3009,7 +3008,6 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
|
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
DBUG_LEAVE; // Must match DBUG_ENTER()
|
|
||||||
signal_thread_in_use= 0;
|
signal_thread_in_use= 0;
|
||||||
pthread_exit(0); // Safety
|
pthread_exit(0); // Safety
|
||||||
return 0; // Avoid compiler warnings
|
return 0; // Avoid compiler warnings
|
||||||
|
|
Loading…
Add table
Reference in a new issue