mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
don't set default value in temp table if NO_DEFAULT_VALUE_FLAG
when an internal temporary table field is created from a real field, a new temp field should only copy a default from the source field when the latter has it
This commit is contained in:
@ -3463,5 +3463,26 @@ SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
|
|||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-29890 Update with inner join false row count result
|
||||||
|
#
|
||||||
|
create table t1 (a int not null);
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='t1';
|
||||||
|
column_name column_default has_default is_nullable
|
||||||
|
a NULL 0 NO
|
||||||
|
create or replace view v1 as select * from t1;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
column_name column_default has_default is_nullable
|
||||||
|
a NULL 0 NO
|
||||||
|
create or replace view v1 as select * from t1 group by a;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
column_name column_default has_default is_nullable
|
||||||
|
a NULL 0 NO
|
||||||
|
create or replace view v1 as select * from t1 group by a with rollup;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
column_name column_default has_default is_nullable
|
||||||
|
a NULL 1 YES
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
# End of 10.4 test
|
# End of 10.4 test
|
||||||
#
|
#
|
||||||
|
@ -2169,6 +2169,20 @@ INSERT INTO t1 VALUES (),();
|
|||||||
SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
|
SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-29890 Update with inner join false row count result
|
||||||
|
--echo #
|
||||||
|
create table t1 (a int not null);
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='t1';
|
||||||
|
create or replace view v1 as select * from t1;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
create or replace view v1 as select * from t1 group by a;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
create or replace view v1 as select * from t1 group by a with rollup;
|
||||||
|
select column_name, column_default, column_default is not null as 'has_default', is_nullable from information_schema.columns where table_schema='test' and table_name='v1';
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.4 test
|
--echo # End of 10.4 test
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -695,7 +695,7 @@ CREATE VIEW v1 AS
|
|||||||
SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
||||||
DESC v1;
|
DESC v1;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
a int(11) YES 0
|
a int(11) YES NULL
|
||||||
LENGTH(a) int(10) YES NULL
|
LENGTH(a) int(10) YES NULL
|
||||||
COUNT(*) bigint(21) NO 0
|
COUNT(*) bigint(21) NO 0
|
||||||
SELECT * FROM v1;
|
SELECT * FROM v1;
|
||||||
@ -858,7 +858,7 @@ INSERT INTO t1 VALUES (1),(2);
|
|||||||
CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
||||||
DESCRIBE v1;
|
DESCRIBE v1;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
a int(11) YES 0
|
a int(11) YES NULL
|
||||||
LENGTH(a) int(10) YES NULL
|
LENGTH(a) int(10) YES NULL
|
||||||
COUNT(*) bigint(21) NO 0
|
COUNT(*) bigint(21) NO 0
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
@ -868,7 +868,7 @@ INSERT INTO t1 VALUES (1),(2);
|
|||||||
CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
|
||||||
DESCRIBE v1;
|
DESCRIBE v1;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
a bigint(20) YES 0
|
a bigint(20) YES NULL
|
||||||
LENGTH(a) int(10) YES NULL
|
LENGTH(a) int(10) YES NULL
|
||||||
COUNT(*) bigint(21) NO 0
|
COUNT(*) bigint(21) NO 0
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
@ -893,8 +893,8 @@ DROP VIEW v1;
|
|||||||
CREATE VIEW v1 AS SELECT a, b FROM t1 GROUP BY a,b WITH ROLLUP;
|
CREATE VIEW v1 AS SELECT a, b FROM t1 GROUP BY a,b WITH ROLLUP;
|
||||||
DESC v1;
|
DESC v1;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
a int(11) YES 0
|
a int(11) YES NULL
|
||||||
b int(20) YES 0
|
b int(20) YES NULL
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
@ -18241,7 +18241,8 @@ Field *Item_field::create_tmp_field_ex(TABLE *table,
|
|||||||
src->set_field(field);
|
src->set_field(field);
|
||||||
if (!(result= create_tmp_field_from_item_field(table, NULL, param)))
|
if (!(result= create_tmp_field_from_item_field(table, NULL, param)))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (field->eq_def(result))
|
if (!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||||
|
field->eq_def(result))
|
||||||
src->set_default_field(field);
|
src->set_default_field(field);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user