Loading libmysql/libmysql.c +4 −3 Original line number Diff line number Diff line Loading @@ -706,7 +706,8 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd) my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db) { char buff[512],*end=buff; char buff[USERNAME_LENGTH+SCRAMBLED_PASSWORD_CHAR_LENGTH+NAME_LEN+2]; char *end= buff; int rc; DBUG_ENTER("mysql_change_user"); Loading @@ -716,7 +717,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, passwd=""; /* Store user into the buffer */ end=strmov(end,user)+1; end= strmake(end, user, USERNAME_LENGTH) + 1; /* write scrambled password according to server capabilities */ if (passwd[0]) Loading @@ -736,7 +737,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, else *end++= '\0'; /* empty password */ /* Add database if needed */ end= strmov(end, db ? db : "") + 1; end= strmake(end, db ? db : "", NAME_LEN) + 1; /* Write authentication package */ simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1); Loading mysql-test/r/select.result +35 −0 Original line number Diff line number Diff line Loading @@ -4096,4 +4096,39 @@ SELECT `x` FROM v3; x 1 DROP VIEW v1, v2, v3; # # Bug#30736: Row Size Too Large Error Creating a Table and # Inserting Data. # DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1( c1 DECIMAL(10, 2), c2 FLOAT); INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); CREATE TABLE t2( c3 DECIMAL(10, 2)) SELECT c1 * c2 AS c3 FROM t1; SELECT * FROM t1; c1 c2 0.00 1 2.00 3 4.00 5 SELECT * FROM t2; c3 0.00 6.00 20.00 DROP TABLE t1; DROP TABLE t2; End of 5.0 tests mysql-test/t/select.test +48 −0 Original line number Diff line number Diff line Loading @@ -3484,4 +3484,52 @@ DROP VIEW v1, v2, v3; --enable_ps_protocol ########################################################################### --echo --echo # --echo # Bug#30736: Row Size Too Large Error Creating a Table and --echo # Inserting Data. --echo # --disable_warnings DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; --enable_warnings --echo CREATE TABLE t1( c1 DECIMAL(10, 2), c2 FLOAT); --echo INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); --echo CREATE TABLE t2( c3 DECIMAL(10, 2)) SELECT c1 * c2 AS c3 FROM t1; --echo SELECT * FROM t1; --echo SELECT * FROM t2; --echo DROP TABLE t1; DROP TABLE t2; --echo ########################################################################### --echo End of 5.0 tests sql/sql_acl.cc +13 −11 Original line number Diff line number Diff line Loading @@ -311,7 +311,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) continue; } const char *password= get_field(&mem, table->field[2]); const char *password= get_field(thd->mem_root, table->field[2]); uint password_len= password ? strlen(password) : 0; set_user_salt(&user, password, password_len); if (user.salt_len == 0 && password_len != 0) Loading Loading @@ -364,7 +364,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) /* Starting from 4.0.2 we have more fields */ if (table->s->fields >= 31) { char *ssl_type=get_field(&mem, table->field[next_field++]); char *ssl_type=get_field(thd->mem_root, table->field[next_field++]); if (!ssl_type) user.ssl_type=SSL_TYPE_NONE; else if (!strcmp(ssl_type, "ANY")) Loading @@ -378,11 +378,11 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) user.x509_issuer= get_field(&mem, table->field[next_field++]); user.x509_subject= get_field(&mem, table->field[next_field++]); char *ptr = get_field(&mem, table->field[next_field++]); char *ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.questions=ptr ? atoi(ptr) : 0; ptr = get_field(&mem, table->field[next_field++]); ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.updates=ptr ? atoi(ptr) : 0; ptr = get_field(&mem, table->field[next_field++]); ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.conn_per_hour= ptr ? atoi(ptr) : 0; if (user.user_resource.questions || user.user_resource.updates || user.user_resource.conn_per_hour) Loading @@ -391,7 +391,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) if (table->s->fields >= 36) { /* Starting from 5.0.3 we have max_user_connections field */ ptr= get_field(&mem, table->field[next_field++]); ptr= get_field(thd->mem_root, table->field[next_field++]); user.user_resource.user_conn= ptr ? atoi(ptr) : 0; } else Loading Loading @@ -4898,6 +4898,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, byte user_key[MAX_KEY_LENGTH]; uint key_prefix_length; DBUG_ENTER("handle_grant_table"); THD *thd= current_thd; if (! table_no) // mysql.user table { Loading Loading @@ -4965,17 +4966,18 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, DBUG_PRINT("info",("scan error: %d", error)); continue; } if (! (host= get_field(&mem, host_field))) if (! (host= get_field(thd->mem_root, host_field))) host= ""; if (! (user= get_field(&mem, user_field))) if (! (user= get_field(thd->mem_root, user_field))) user= ""; #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan fields: '%s'@'%s' '%s' '%s' '%s'", user, host, get_field(&mem, table->field[1]) /*db*/, get_field(&mem, table->field[3]) /*table*/, get_field(&mem, table->field[4]) /*column*/)); get_field(thd->mem_root, table->field[1]) /*db*/, get_field(thd->mem_root, table->field[3]) /*table*/, get_field(thd->mem_root, table->field[4]) /*column*/)); #endif if (strcmp(user_str, user) || my_strcasecmp(system_charset_info, host_str, host)) Loading sql/sql_table.cc +1 −1 Original line number Diff line number Diff line Loading @@ -955,8 +955,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->length= dup_field->char_length; sql_field->pack_length= dup_field->pack_length; sql_field->key_length= dup_field->key_length; sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; sql_field->create_length_to_internal_length(); sql_field->unireg_check= dup_field->unireg_check; /* We're making one field from two, the result field will have Loading Loading
libmysql/libmysql.c +4 −3 Original line number Diff line number Diff line Loading @@ -706,7 +706,8 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd) my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db) { char buff[512],*end=buff; char buff[USERNAME_LENGTH+SCRAMBLED_PASSWORD_CHAR_LENGTH+NAME_LEN+2]; char *end= buff; int rc; DBUG_ENTER("mysql_change_user"); Loading @@ -716,7 +717,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, passwd=""; /* Store user into the buffer */ end=strmov(end,user)+1; end= strmake(end, user, USERNAME_LENGTH) + 1; /* write scrambled password according to server capabilities */ if (passwd[0]) Loading @@ -736,7 +737,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, else *end++= '\0'; /* empty password */ /* Add database if needed */ end= strmov(end, db ? db : "") + 1; end= strmake(end, db ? db : "", NAME_LEN) + 1; /* Write authentication package */ simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1); Loading
mysql-test/r/select.result +35 −0 Original line number Diff line number Diff line Loading @@ -4096,4 +4096,39 @@ SELECT `x` FROM v3; x 1 DROP VIEW v1, v2, v3; # # Bug#30736: Row Size Too Large Error Creating a Table and # Inserting Data. # DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1( c1 DECIMAL(10, 2), c2 FLOAT); INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); CREATE TABLE t2( c3 DECIMAL(10, 2)) SELECT c1 * c2 AS c3 FROM t1; SELECT * FROM t1; c1 c2 0.00 1 2.00 3 4.00 5 SELECT * FROM t2; c3 0.00 6.00 20.00 DROP TABLE t1; DROP TABLE t2; End of 5.0 tests
mysql-test/t/select.test +48 −0 Original line number Diff line number Diff line Loading @@ -3484,4 +3484,52 @@ DROP VIEW v1, v2, v3; --enable_ps_protocol ########################################################################### --echo --echo # --echo # Bug#30736: Row Size Too Large Error Creating a Table and --echo # Inserting Data. --echo # --disable_warnings DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; --enable_warnings --echo CREATE TABLE t1( c1 DECIMAL(10, 2), c2 FLOAT); --echo INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5); --echo CREATE TABLE t2( c3 DECIMAL(10, 2)) SELECT c1 * c2 AS c3 FROM t1; --echo SELECT * FROM t1; --echo SELECT * FROM t2; --echo DROP TABLE t1; DROP TABLE t2; --echo ########################################################################### --echo End of 5.0 tests
sql/sql_acl.cc +13 −11 Original line number Diff line number Diff line Loading @@ -311,7 +311,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) continue; } const char *password= get_field(&mem, table->field[2]); const char *password= get_field(thd->mem_root, table->field[2]); uint password_len= password ? strlen(password) : 0; set_user_salt(&user, password, password_len); if (user.salt_len == 0 && password_len != 0) Loading Loading @@ -364,7 +364,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) /* Starting from 4.0.2 we have more fields */ if (table->s->fields >= 31) { char *ssl_type=get_field(&mem, table->field[next_field++]); char *ssl_type=get_field(thd->mem_root, table->field[next_field++]); if (!ssl_type) user.ssl_type=SSL_TYPE_NONE; else if (!strcmp(ssl_type, "ANY")) Loading @@ -378,11 +378,11 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) user.x509_issuer= get_field(&mem, table->field[next_field++]); user.x509_subject= get_field(&mem, table->field[next_field++]); char *ptr = get_field(&mem, table->field[next_field++]); char *ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.questions=ptr ? atoi(ptr) : 0; ptr = get_field(&mem, table->field[next_field++]); ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.updates=ptr ? atoi(ptr) : 0; ptr = get_field(&mem, table->field[next_field++]); ptr = get_field(thd->mem_root, table->field[next_field++]); user.user_resource.conn_per_hour= ptr ? atoi(ptr) : 0; if (user.user_resource.questions || user.user_resource.updates || user.user_resource.conn_per_hour) Loading @@ -391,7 +391,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) if (table->s->fields >= 36) { /* Starting from 5.0.3 we have max_user_connections field */ ptr= get_field(&mem, table->field[next_field++]); ptr= get_field(thd->mem_root, table->field[next_field++]); user.user_resource.user_conn= ptr ? atoi(ptr) : 0; } else Loading Loading @@ -4898,6 +4898,7 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, byte user_key[MAX_KEY_LENGTH]; uint key_prefix_length; DBUG_ENTER("handle_grant_table"); THD *thd= current_thd; if (! table_no) // mysql.user table { Loading Loading @@ -4965,17 +4966,18 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, DBUG_PRINT("info",("scan error: %d", error)); continue; } if (! (host= get_field(&mem, host_field))) if (! (host= get_field(thd->mem_root, host_field))) host= ""; if (! (user= get_field(&mem, user_field))) if (! (user= get_field(thd->mem_root, user_field))) user= ""; #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan fields: '%s'@'%s' '%s' '%s' '%s'", user, host, get_field(&mem, table->field[1]) /*db*/, get_field(&mem, table->field[3]) /*table*/, get_field(&mem, table->field[4]) /*column*/)); get_field(thd->mem_root, table->field[1]) /*db*/, get_field(thd->mem_root, table->field[3]) /*table*/, get_field(thd->mem_root, table->field[4]) /*column*/)); #endif if (strcmp(user_str, user) || my_strcasecmp(system_charset_info, host_str, host)) Loading
sql/sql_table.cc +1 −1 Original line number Diff line number Diff line Loading @@ -955,8 +955,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->length= dup_field->char_length; sql_field->pack_length= dup_field->pack_length; sql_field->key_length= dup_field->key_length; sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; sql_field->create_length_to_internal_length(); sql_field->unireg_check= dup_field->unireg_check; /* We're making one field from two, the result field will have Loading