Skip to content

Commit 8aa2076

Browse files
committed
Revert "MDEV-22243 type_test.type_test_double fails with 'NUMERIC_SCALE NULL'"
This reverts commit 9d19b65.
1 parent 8bbf669 commit 8aa2076

File tree

3 files changed

+39
-60
lines changed

3 files changed

+39
-60
lines changed

plugin/type_test/mysql-test/type_test/type_test_double.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ DATA_TYPE test_double
290290
CHARACTER_MAXIMUM_LENGTH NULL
291291
CHARACTER_OCTET_LENGTH NULL
292292
NUMERIC_PRECISION 22
293-
NUMERIC_SCALE NULL
293+
NUMERIC_SCALE 31
294294
DATETIME_PRECISION NULL
295295
CHARACTER_SET_NAME NULL
296296
COLLATION_NAME NULL

sql/field.cc

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4645,28 +4645,6 @@ bool Field_longlong::is_max()
46454645
single precision float
46464646
****************************************************************************/
46474647

4648-
Field_float::Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
4649-
uchar null_bit_arg,
4650-
enum utype unireg_check_arg,
4651-
const LEX_CSTRING *field_name_arg,
4652-
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
4653-
:Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
4654-
unireg_check_arg, field_name_arg,
4655-
(dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg),
4656-
zero_arg, unsigned_arg)
4657-
{
4658-
}
4659-
4660-
Field_float::Field_float(uint32 len_arg, bool maybe_null_arg,
4661-
const LEX_CSTRING *field_name_arg, uint8 dec_arg)
4662-
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
4663-
NONE, field_name_arg,
4664-
(dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg),
4665-
0, 0)
4666-
{
4667-
}
4668-
4669-
46704648
int Field_float::store(const char *from,size_t len,CHARSET_INFO *cs)
46714649
{
46724650
int error;
@@ -4815,38 +4793,6 @@ Binlog_type_info Field_float::binlog_type_info() const
48154793
double precision floating point numbers
48164794
****************************************************************************/
48174795

4818-
Field_double::Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
4819-
uchar null_bit_arg,
4820-
enum utype unireg_check_arg,
4821-
const LEX_CSTRING *field_name_arg,
4822-
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
4823-
:Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
4824-
unireg_check_arg, field_name_arg,
4825-
(dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg),
4826-
zero_arg, unsigned_arg)
4827-
{
4828-
}
4829-
4830-
Field_double::Field_double(uint32 len_arg, bool maybe_null_arg,
4831-
const LEX_CSTRING *field_name_arg, uint8 dec_arg)
4832-
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
4833-
NONE, field_name_arg,
4834-
(dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg),
4835-
0, 0)
4836-
{
4837-
}
4838-
4839-
Field_double::Field_double(uint32 len_arg, bool maybe_null_arg,
4840-
const LEX_CSTRING *field_name_arg,
4841-
uint8 dec_arg, bool not_fixed_arg)
4842-
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
4843-
NONE, field_name_arg,
4844-
(dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg),
4845-
0, 0)
4846-
{
4847-
not_fixed= not_fixed_arg;
4848-
}
4849-
48504796
int Field_double::store(const char *from,size_t len,CHARSET_INFO *cs)
48514797
{
48524798
int error;

sql/field.h

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,9 +2842,22 @@ class Field_float final :public Field_real {
28422842
Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
28432843
uchar null_bit_arg,
28442844
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
2845-
uint8 dec_arg,bool zero_arg,bool unsigned_arg);
2845+
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
2846+
:Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
2847+
unireg_check_arg, field_name_arg,
2848+
dec_arg, zero_arg, unsigned_arg)
2849+
{
2850+
if (dec_arg >= FLOATING_POINT_DECIMALS)
2851+
dec_arg= NOT_FIXED_DEC;
2852+
}
28462853
Field_float(uint32 len_arg, bool maybe_null_arg,
2847-
const LEX_CSTRING *field_name_arg, uint8 dec_arg);
2854+
const LEX_CSTRING *field_name_arg, uint8 dec_arg)
2855+
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
2856+
NONE, field_name_arg, dec_arg, 0, 0)
2857+
{
2858+
if (dec_arg >= FLOATING_POINT_DECIMALS)
2859+
dec_arg= NOT_FIXED_DEC;
2860+
}
28482861
const Type_handler *type_handler() const override
28492862
{ return &type_handler_float; }
28502863
enum ha_base_keytype key_type() const override { return HA_KEYTYPE_FLOAT; }
@@ -2877,12 +2890,32 @@ class Field_double :public Field_real {
28772890
Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
28782891
uchar null_bit_arg,
28792892
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
2880-
uint8 dec_arg,bool zero_arg,bool unsigned_arg);
2893+
uint8 dec_arg,bool zero_arg,bool unsigned_arg)
2894+
:Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
2895+
unireg_check_arg, field_name_arg,
2896+
dec_arg, zero_arg, unsigned_arg)
2897+
{
2898+
if (dec_arg >= FLOATING_POINT_DECIMALS)
2899+
dec_arg= NOT_FIXED_DEC;
2900+
}
28812901
Field_double(uint32 len_arg, bool maybe_null_arg,
2882-
const LEX_CSTRING *field_name_arg, uint8 dec_arg);
2902+
const LEX_CSTRING *field_name_arg, uint8 dec_arg)
2903+
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
2904+
NONE, field_name_arg, dec_arg, 0, 0)
2905+
{
2906+
if (dec_arg >= FLOATING_POINT_DECIMALS)
2907+
dec_arg= NOT_FIXED_DEC;
2908+
}
28832909
Field_double(uint32 len_arg, bool maybe_null_arg,
28842910
const LEX_CSTRING *field_name_arg,
2885-
uint8 dec_arg, bool not_fixed_arg);
2911+
uint8 dec_arg, bool not_fixed_arg)
2912+
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
2913+
NONE, field_name_arg, dec_arg, 0, 0)
2914+
{
2915+
not_fixed= not_fixed_arg;
2916+
if (dec_arg >= FLOATING_POINT_DECIMALS)
2917+
dec_arg= NOT_FIXED_DEC;
2918+
}
28862919
void init_for_tmp_table(Field *org_field, TABLE *new_table) override
28872920
{
28882921
Field::init_for_tmp_table(org_field, new_table);

0 commit comments

Comments
 (0)