Commit 5fb25164 authored by Marko Mäkelä's avatar Marko Mäkelä

Commit the MDEV-17023 fix with the correct number

parents 69d7bfd9 51fb163b
CREATE OR REPLACE TABLE t1 (
f1 DECIMAL(43,0) NOT NULL,
f2 TIME(4) NULL,
f3 BINARY(101) NULL,
f4 TIMESTAMP(4) NULL,
f5 DATETIME(1) NULL,
f6 SET('a','b','c') NOT NULL DEFAULT 'a',
f7 VARBINARY(2332) NOT NULL DEFAULT '',
f8 DATE NULL,
f9 BLOB NULL,
f10 MEDIUMINT(45) NOT NULL DEFAULT 0,
f11 YEAR NULL,
f12 BIT(58) NULL,
v2 TIME(1) AS (f2) VIRTUAL,
v3 BINARY(115) AS (f3) VIRTUAL,
v4 TIMESTAMP(3) AS (f4) VIRTUAL,
v7 VARBINARY(658) AS (f7) PERSISTENT,
v8 DATE AS (f8) PERSISTENT,
v9 TINYTEXT AS (f9) PERSISTENT,
v11 YEAR AS (f11) VIRTUAL
) ENGINE=Aria;
INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES
(0.8,'16:01:46',NULL,'2006-03-01 12:44:34','2029-10-10 21:27:53','a','foo','1989-12-24','bar',9,1975,b'1');
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a INT(45));
INSERT IGNORE INTO t1 VALUES (1),(2);
CREATE OR REPLACE TABLE t2 ENGINE=Aria AS SELECT SUM(a) AS f1, IFNULL( 'qux', ExtractValue( 'foo', 'bar' ) ) AS f2 FROM t1;
select * from t2;
f1 f2
3 qux
DROP TABLE t1, t2;
--source include/have_maria.inc
# MDEV-17021
# Server crash or assertion `length <= column->length' failure in
# write_block_record
#
CREATE OR REPLACE TABLE t1 (
f1 DECIMAL(43,0) NOT NULL,
f2 TIME(4) NULL,
f3 BINARY(101) NULL,
f4 TIMESTAMP(4) NULL,
f5 DATETIME(1) NULL,
f6 SET('a','b','c') NOT NULL DEFAULT 'a',
f7 VARBINARY(2332) NOT NULL DEFAULT '',
f8 DATE NULL,
f9 BLOB NULL,
f10 MEDIUMINT(45) NOT NULL DEFAULT 0,
f11 YEAR NULL,
f12 BIT(58) NULL,
v2 TIME(1) AS (f2) VIRTUAL,
v3 BINARY(115) AS (f3) VIRTUAL,
v4 TIMESTAMP(3) AS (f4) VIRTUAL,
v7 VARBINARY(658) AS (f7) PERSISTENT,
v8 DATE AS (f8) PERSISTENT,
v9 TINYTEXT AS (f9) PERSISTENT,
v11 YEAR AS (f11) VIRTUAL
) ENGINE=Aria;
INSERT IGNORE INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12) VALUES
(0.8,'16:01:46',NULL,'2006-03-01 12:44:34','2029-10-10 21:27:53','a','foo','1989-12-24','bar',9,1975,b'1');
DROP TABLE t1;
#
# MDEV-17067 Server crash in write_block_record
#
CREATE OR REPLACE TABLE t1 (a INT(45));
INSERT IGNORE INTO t1 VALUES (1),(2);
CREATE OR REPLACE TABLE t2 ENGINE=Aria AS SELECT SUM(a) AS f1, IFNULL( 'qux', ExtractValue( 'foo', 'bar' ) ) AS f2 FROM t1;
select * from t2;
DROP TABLE t1, t2;
...@@ -210,7 +210,7 @@ cannot_find_file() ...@@ -210,7 +210,7 @@ cannot_find_file()
echo echo
echo "If you compiled from source, you need to either run 'make install' to" echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation." echo "copy the software into the correct location ready for operation."
echo "If you don't want to do a full install, you can use the --srcddir" echo "If you don't want to do a full install, you can use the --srcdir"
echo "option to only install the mysql database and privilege tables" echo "option to only install the mysql database and privilege tables"
echo echo
echo "If you compiled from source, you need to either run 'make install' to" echo "If you compiled from source, you need to either run 'make install' to"
......
...@@ -9065,13 +9065,18 @@ void Create_field::create_length_to_internal_length(void) ...@@ -9065,13 +9065,18 @@ void Create_field::create_length_to_internal_length(void)
} }
break; break;
case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_NEWDECIMAL:
key_length= pack_length= {
my_decimal_get_binary_size(my_decimal_length_to_precision(length, /*
decimals, This code must be identical to code in
flags & Field_new_decimal::Field_new_decimal as otherwise the record layout
UNSIGNED_FLAG), gets out of sync.
decimals); */
uint precision= my_decimal_length_to_precision(length, decimals,
flags & UNSIGNED_FLAG);
set_if_smaller(precision, DECIMAL_MAX_PRECISION);
key_length= pack_length= my_decimal_get_binary_size(precision, decimals);
break; break;
}
default: default:
key_length= pack_length= calc_pack_length(sql_type, length); key_length= pack_length= calc_pack_length(sql_type, length);
break; break;
......
...@@ -3328,6 +3328,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -3328,6 +3328,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
} }
} }
/* Virtual fields are always NULL */
if (sql_field->vcol_info)
sql_field->flags&= ~NOT_NULL_FLAG;
if (sql_field->sql_type == MYSQL_TYPE_SET || if (sql_field->sql_type == MYSQL_TYPE_SET ||
sql_field->sql_type == MYSQL_TYPE_ENUM) sql_field->sql_type == MYSQL_TYPE_ENUM)
{ {
......
...@@ -153,7 +153,7 @@ bool JAVAConn::Check(jint rc) ...@@ -153,7 +153,7 @@ bool JAVAConn::Check(jint rc)
if (exc != nullptr && tid != nullptr) { if (exc != nullptr && tid != nullptr) {
jstring s = (jstring)env->CallObjectMethod(exc, tid); jstring s = (jstring)env->CallObjectMethod(exc, tid);
const char *utf = env->GetStringUTFChars(s, (jboolean)false); const char *utf = env->GetStringUTFChars(s, NULL);
env->DeleteLocalRef(s); env->DeleteLocalRef(s);
Msg = PlugDup(m_G, utf); Msg = PlugDup(m_G, utf);
} else } else
...@@ -162,7 +162,7 @@ bool JAVAConn::Check(jint rc) ...@@ -162,7 +162,7 @@ bool JAVAConn::Check(jint rc)
env->ExceptionClear(); env->ExceptionClear();
} else if (rc < 0) { } else if (rc < 0) {
s = (jstring)env->CallObjectMethod(job, errid); s = (jstring)env->CallObjectMethod(job, errid);
Msg = (char*)env->GetStringUTFChars(s, (jboolean)false); Msg = (char*)env->GetStringUTFChars(s, NULL);
} else } else
Msg = NULL; Msg = NULL;
...@@ -456,7 +456,7 @@ bool JAVAConn::Open(PGLOBAL g) ...@@ -456,7 +456,7 @@ bool JAVAConn::Open(PGLOBAL g)
//=============== load and initialize Java VM and JNI interface ============= //=============== load and initialize Java VM and JNI interface =============
rc = CreateJavaVM(&jvm, (void**)&env, &vm_args); // YES !! rc = CreateJavaVM(&jvm, (void**)&env, &vm_args); // YES !!
delete options; // we then no longer need the initialisation options. delete[] options; // we then no longer need the initialisation options.
switch (rc) { switch (rc) {
case JNI_OK: case JNI_OK:
......
...@@ -828,11 +828,11 @@ bool JDBConn::Connect(PJPARM sop) ...@@ -828,11 +828,11 @@ bool JDBConn::Connect(PJPARM sop)
jstring s = (jstring)env->CallObjectMethod(job, qcid); jstring s = (jstring)env->CallObjectMethod(job, qcid);
if (s != nullptr) { if (s != nullptr) {
char *qch = (char*)env->GetStringUTFChars(s, (jboolean)false); char *qch = (char*)env->GetStringUTFChars(s, NULL);
m_IDQuoteChar[0] = *qch; m_IDQuoteChar[0] = *qch;
} else { } else {
s = (jstring)env->CallObjectMethod(job, errid); s = (jstring)env->CallObjectMethod(job, errid);
Msg = (char*)env->GetStringUTFChars(s, (jboolean)false); Msg = (char*)env->GetStringUTFChars(s, NULL);
} // endif s } // endif s
} // endif qcid } // endif qcid
...@@ -1010,7 +1010,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) ...@@ -1010,7 +1010,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
cn = nullptr; cn = nullptr;
if (cn) { if (cn) {
field = env->GetStringUTFChars(cn, (jboolean)false); field = env->GetStringUTFChars(cn, NULL);
val->SetValue_psz((PSZ)field); val->SetValue_psz((PSZ)field);
} else } else
val->Reset(); val->Reset();
...@@ -1084,7 +1084,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) ...@@ -1084,7 +1084,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
cn = nullptr; cn = nullptr;
if (cn) { if (cn) {
const char *field = env->GetStringUTFChars(cn, (jboolean)false); const char *field = env->GetStringUTFChars(cn, NULL);
val->SetValue_psz((PSZ)field); val->SetValue_psz((PSZ)field);
} else } else
val->Reset(); val->Reset();
...@@ -1462,7 +1462,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) ...@@ -1462,7 +1462,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
return NULL; return NULL;
} // endif label } // endif label
name = env->GetStringUTFChars(label, (jboolean)false); name = env->GetStringUTFChars(label, NULL);
crp = qrp->Colresp; // Column_Name crp = qrp->Colresp; // Column_Name
crp->Kdata->SetValue((char*)name, i); crp->Kdata->SetValue((char*)name, i);
n = env->GetIntArrayElements(val, 0); n = env->GetIntArrayElements(val, 0);
......
...@@ -522,7 +522,7 @@ PSZ JMgoConn::GetDocument(void) ...@@ -522,7 +522,7 @@ PSZ JMgoConn::GetDocument(void)
jdc = (jstring)env->CallObjectMethod(job, getdocid); jdc = (jstring)env->CallObjectMethod(job, getdocid);
if (jdc) if (jdc)
doc = (PSZ)env->GetStringUTFChars(jdc, (jboolean)false); doc = (PSZ)env->GetStringUTFChars(jdc, NULL);
} // endif getdocid } // endif getdocid
...@@ -807,7 +807,7 @@ PSZ JMgoConn::GetColumnValue(PSZ path) ...@@ -807,7 +807,7 @@ PSZ JMgoConn::GetColumnValue(PSZ path)
fn = (jstring)env->CallObjectMethod(job, objfldid, jn); fn = (jstring)env->CallObjectMethod(job, objfldid, jn);
if (fn) if (fn)
fld = (PSZ)env->GetStringUTFChars(fn, (jboolean)false); fld = (PSZ)env->GetStringUTFChars(fn, NULL);
} // endif objfldid } // endif objfldid
......
...@@ -101,7 +101,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt, ...@@ -101,7 +101,7 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
continue; continue;
jkey = (jstring)Jcp->env->CallObjectMethod(Jcp->job, bvnameid); jkey = (jstring)Jcp->env->CallObjectMethod(Jcp->job, bvnameid);
key = Jcp->env->GetStringUTFChars(jkey, (jboolean)false); key = Jcp->env->GetStringUTFChars(jkey, NULL);
if (pcn) { if (pcn) {
strncpy(colname, pcn, 64); strncpy(colname, pcn, 64);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment