mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge remote-tracking branch 'origin/10.3' into 10.4
This commit is contained in:
@ -1,121 +0,0 @@
|
||||
#
|
||||
# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
|
||||
#
|
||||
CREATE user boo1;
|
||||
GRANT select,create,alter,drop on foo.* to boo1;
|
||||
SHOW GRANTS for boo1;
|
||||
Grants for boo1@%
|
||||
GRANT USAGE ON *.* TO 'boo1'@'%'
|
||||
GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
|
||||
CREATE user boo2;
|
||||
create database foo;
|
||||
CONNECT con1,localhost, boo1,, foo;
|
||||
SET check_constraint_checks=1;
|
||||
CREATE TABLE t0
|
||||
(
|
||||
t int, check (t>32) # table constraint
|
||||
) ENGINE=myisam;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CHK_t0_t t0 `t` < 100
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
ALTER TABLE t0
|
||||
DROP CONSTRAINT CHK_t0_t;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHECK(t<50);
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
CREATE TABLE t1
|
||||
( t int CHECK(t>2), # field constraint
|
||||
tt int,
|
||||
CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
|
||||
CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
|
||||
) ENGINE=InnoDB;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CHK_tt t1 `tt` < 100
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_1 t1 `tt` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
def foo CONSTRAINT_2 t1 `tt` < 50
|
||||
def foo t t1 `t` > 2
|
||||
ALTER TABLE t1
|
||||
DROP CONSTRAINT CHK_tt;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_1 t1 `tt` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
def foo CONSTRAINT_2 t1 `tt` < 50
|
||||
def foo t t1 `t` > 2
|
||||
CREATE TABLE t2
|
||||
(
|
||||
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
|
||||
start_date DATE,
|
||||
end_date DATE,
|
||||
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
|
||||
)ENGINE=Innodb;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CHK_dates t2 `start_date` is null
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_1 t1 `tt` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
def foo CONSTRAINT_2 t1 `tt` < 50
|
||||
def foo name t2 char_length(`name`) > 2
|
||||
def foo t t1 `t` > 2
|
||||
ALTER TABLE t1
|
||||
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CHK_dates t2 `start_date` is null
|
||||
def foo CHK_new_ t1 `t` > `tt`
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_1 t1 `tt` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
def foo CONSTRAINT_2 t1 `tt` < 50
|
||||
def foo name t2 char_length(`name`) > 2
|
||||
def foo t t1 `t` > 2
|
||||
CREATE TABLE t3
|
||||
(
|
||||
a int,
|
||||
b int check (b>0), # field constraint named 'b'
|
||||
CONSTRAINT b check (b>10) # table constraint
|
||||
) ENGINE=InnoDB;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def foo CHK_dates t2 `start_date` is null
|
||||
def foo CHK_new_ t1 `t` > `tt`
|
||||
def foo CONSTRAINT_1 t0 `t` > 32
|
||||
def foo CONSTRAINT_1 t1 `tt` > 32
|
||||
def foo CONSTRAINT_2 t0 `t` < 50
|
||||
def foo CONSTRAINT_2 t1 `tt` < 50
|
||||
def foo b t3 `b` > 0
|
||||
def foo b t3 `b` > 10
|
||||
def foo name t2 char_length(`name`) > 2
|
||||
def foo t t1 `t` > 2
|
||||
disconnect con1;
|
||||
CONNECT con2, localhost, boo2,, test;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
disconnect con2;
|
||||
CONNECT con1, localhost, boo1,,foo;
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP DATABASE foo;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
DROP USER boo1;
|
||||
DROP USER boo2;
|
@ -1,180 +1,148 @@
|
||||
#
|
||||
# MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
|
||||
#
|
||||
set check_constraint_checks=1;
|
||||
use test;
|
||||
create table t0
|
||||
CREATE user boo1;
|
||||
GRANT select,create,alter,drop on foo.* to boo1;
|
||||
SHOW GRANTS for boo1;
|
||||
Grants for boo1@%
|
||||
GRANT USAGE ON *.* TO 'boo1'@'%'
|
||||
GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
|
||||
CREATE user boo2;
|
||||
create database foo;
|
||||
CONNECT con1,localhost, boo1,, foo;
|
||||
SET check_constraint_checks=1;
|
||||
CREATE TABLE t0
|
||||
(
|
||||
t int, check (t>32) # table constraint
|
||||
) ENGINE=myisam;
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CHK_t0_t
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` < 100
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CHK_t0_t `t` < 100
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
ALTER TABLE t0
|
||||
DROP CONSTRAINT CHK_t0_t;
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHECK(t<50);
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
CREATE TABLE t1
|
||||
( t int CHECK(t>2), # field constraint
|
||||
tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
|
||||
tt int,
|
||||
CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
|
||||
CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
|
||||
) ENGINE=InnoDB;
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CHK_tt
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `tt` < 100
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME t
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `t` > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
def foo t1 CHK_tt `tt` < 100
|
||||
def foo t1 CONSTRAINT_1 `tt` > 32
|
||||
def foo t1 CONSTRAINT_2 `tt` < 50
|
||||
def foo t1 t `t` > 2
|
||||
ALTER TABLE t1
|
||||
DROP CONSTRAINT CHK_tt;
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME t
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `t` > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
create table t2
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
def foo t1 CONSTRAINT_1 `tt` > 32
|
||||
def foo t1 CONSTRAINT_2 `tt` < 50
|
||||
def foo t1 t `t` > 2
|
||||
CREATE TABLE t2
|
||||
(
|
||||
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
|
||||
start_date DATE,
|
||||
end_date DATE,
|
||||
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
|
||||
)ENGINE=Innodb;
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME name
|
||||
TABLE_NAME t2
|
||||
CHECK_CLAUSE char_length(`name`) > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CHK_dates
|
||||
TABLE_NAME t2
|
||||
CHECK_CLAUSE `start_date` is null
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME t
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `t` > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
def foo t1 CONSTRAINT_1 `tt` > 32
|
||||
def foo t1 CONSTRAINT_2 `tt` < 50
|
||||
def foo t1 t `t` > 2
|
||||
def foo t2 CHK_dates `start_date` is null
|
||||
def foo t2 name char_length(`name`) > 2
|
||||
ALTER TABLE t1
|
||||
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME name
|
||||
TABLE_NAME t2
|
||||
CHECK_CLAUSE char_length(`name`) > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA mysql
|
||||
CONSTRAINT_NAME Priv
|
||||
TABLE_NAME global_priv
|
||||
CHECK_CLAUSE json_valid(`Priv`)
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CHK_dates
|
||||
TABLE_NAME t2
|
||||
CHECK_CLAUSE `start_date` is null
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME t
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `t` > 2
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CONSTRAINT_1
|
||||
TABLE_NAME t0
|
||||
CHECK_CLAUSE `t` > 32
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
CONSTRAINT_NAME CHK_new_
|
||||
TABLE_NAME t1
|
||||
CHECK_CLAUSE `t` > `tt`
|
||||
create table t3
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
def foo t1 CHK_new_ `t` > `tt`
|
||||
def foo t1 CONSTRAINT_1 `tt` > 32
|
||||
def foo t1 CONSTRAINT_2 `tt` < 50
|
||||
def foo t1 t `t` > 2
|
||||
def foo t2 CHK_dates `start_date` is null
|
||||
def foo t2 name char_length(`name`) > 2
|
||||
CREATE TABLE t3
|
||||
(
|
||||
a int,
|
||||
b int check (b>0), # field constraint named 'b'
|
||||
CONSTRAINT b check (b>10) # table constraint
|
||||
) ENGINE=InnoDB;
|
||||
select * from information_schema.check_constraints order by check_clause;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
|
||||
def test name t2 char_length(`name`) > 2
|
||||
def mysql Priv global_priv json_valid(`Priv`)
|
||||
def test b t3 `b` > 0
|
||||
def test b t3 `b` > 10
|
||||
def test CHK_dates t2 `start_date` is null
|
||||
def test t t1 `t` > 2
|
||||
def test CONSTRAINT_1 t0 `t` > 32
|
||||
def test CHK_new_ t1 `t` > `tt`
|
||||
drop table t0;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def foo t0 CONSTRAINT_1 `t` > 32
|
||||
def foo t0 CONSTRAINT_2 `t` < 50
|
||||
def foo t1 CHK_new_ `t` > `tt`
|
||||
def foo t1 CONSTRAINT_1 `tt` > 32
|
||||
def foo t1 CONSTRAINT_2 `tt` < 50
|
||||
def foo t1 t `t` > 2
|
||||
def foo t2 CHK_dates `start_date` is null
|
||||
def foo t2 name char_length(`name`) > 2
|
||||
def foo t3 b `b` > 0
|
||||
def foo t3 b `b` > 10
|
||||
disconnect con1;
|
||||
CONNECT con2, localhost, boo2,, test;
|
||||
SELECT * from information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
disconnect con2;
|
||||
CONNECT con1, localhost, boo1,,foo;
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP DATABASE foo;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
DROP USER boo1;
|
||||
DROP USER boo2;
|
||||
#
|
||||
# MDEV-18440: Information_schema.check_constraints possible data leak
|
||||
#
|
||||
CREATE USER foo;
|
||||
CREATE DATABASE db;
|
||||
USE db;
|
||||
CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
|
||||
INSERT INTO t1 VALUES (1, 2), (2, 3);
|
||||
GRANT SELECT (a) ON t1 TO foo;
|
||||
SHOW GRANTS FOR foo;
|
||||
Grants for foo@%
|
||||
GRANT USAGE ON *.* TO 'foo'@'%'
|
||||
GRANT SELECT (a) ON `db`.`t1` TO 'foo'@'%'
|
||||
SELECT * FROM information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
def db t1 CONSTRAINT_1 `b` > 0
|
||||
def mysql global_priv Priv json_valid(`Priv`)
|
||||
CONNECT con1,localhost, foo,, db;
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
SELECT * FROM information_schema.check_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
|
||||
connection default;
|
||||
DROP USER foo;
|
||||
DROP DATABASE db;
|
||||
|
@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
|
||||
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL
|
||||
@ -568,8 +568,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
|
||||
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
|
||||
|
@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
|
||||
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
|
||||
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL
|
||||
@ -568,8 +568,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
|
||||
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
|
||||
|
@ -1,92 +0,0 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
--echo #
|
||||
--echo # MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
|
||||
--echo #
|
||||
CREATE user boo1;
|
||||
GRANT select,create,alter,drop on foo.* to boo1;
|
||||
SHOW GRANTS for boo1;
|
||||
CREATE user boo2;
|
||||
create database foo;
|
||||
# Connect with user boo1
|
||||
CONNECT(con1,localhost, boo1,, foo);
|
||||
|
||||
SET check_constraint_checks=1;
|
||||
CREATE TABLE t0
|
||||
(
|
||||
t int, check (t>32) # table constraint
|
||||
) ENGINE=myisam;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t0
|
||||
DROP CONSTRAINT CHK_t0_t;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHECK(t<50);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
CREATE TABLE t1
|
||||
( t int CHECK(t>2), # field constraint
|
||||
tt int,
|
||||
CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
|
||||
CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
|
||||
) ENGINE=InnoDB;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t1
|
||||
DROP CONSTRAINT CHK_tt;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
CREATE TABLE t2
|
||||
(
|
||||
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
|
||||
start_date DATE,
|
||||
end_date DATE,
|
||||
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
|
||||
)ENGINE=Innodb;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t1
|
||||
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
# Create table with same field and table check constraint name
|
||||
CREATE TABLE t3
|
||||
(
|
||||
a int,
|
||||
b int check (b>0), # field constraint named 'b'
|
||||
CONSTRAINT b check (b>10) # table constraint
|
||||
) ENGINE=InnoDB;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
DISCONNECT con1;
|
||||
CONNECT(con2, localhost, boo2,, test);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
DISCONNECT con2;
|
||||
CONNECT(con1, localhost, boo1,,foo);
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP DATABASE foo;
|
||||
|
||||
DISCONNECT con1;
|
||||
--CONNECTION default
|
||||
DROP USER boo1;
|
||||
DROP USER boo2;
|
@ -1,69 +1,118 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
--echo #
|
||||
--echo # MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
|
||||
--echo #
|
||||
|
||||
set check_constraint_checks=1;
|
||||
CREATE user boo1;
|
||||
GRANT select,create,alter,drop on foo.* to boo1;
|
||||
SHOW GRANTS for boo1;
|
||||
CREATE user boo2;
|
||||
create database foo;
|
||||
# Connect with user boo1
|
||||
CONNECT(con1,localhost, boo1,, foo);
|
||||
|
||||
use test;
|
||||
create table t0
|
||||
SET check_constraint_checks=1;
|
||||
CREATE TABLE t0
|
||||
(
|
||||
t int, check (t>32) # table constraint
|
||||
) ENGINE=myisam;
|
||||
|
||||
--vertical_results
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t0
|
||||
DROP CONSTRAINT CHK_t0_t;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
ALTER TABLE t0
|
||||
ADD CONSTRAINT CHECK(t<50);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
CREATE TABLE t1
|
||||
( t int CHECK(t>2), # field constraint
|
||||
tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
|
||||
tt int,
|
||||
CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
|
||||
CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t1
|
||||
DROP CONSTRAINT CHK_tt;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
|
||||
create table t2
|
||||
CREATE TABLE t2
|
||||
(
|
||||
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
|
||||
start_date DATE,
|
||||
end_date DATE,
|
||||
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
|
||||
)ENGINE=Innodb;
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
ALTER TABLE t1
|
||||
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
|
||||
|
||||
SELECT * from information_schema.check_constraints order by check_clause;
|
||||
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
# Create table with same field and table check constraint name
|
||||
create table t3
|
||||
CREATE TABLE t3
|
||||
(
|
||||
a int,
|
||||
b int check (b>0), # field constraint named 'b'
|
||||
CONSTRAINT b check (b>10) # table constraint
|
||||
) ENGINE=InnoDB;
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
--horizontal_results
|
||||
select * from information_schema.check_constraints order by check_clause;
|
||||
DISCONNECT con1;
|
||||
CONNECT(con2, localhost, boo2,, test);
|
||||
--sorted_result
|
||||
SELECT * from information_schema.check_constraints;
|
||||
|
||||
drop table t0;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
DISCONNECT con2;
|
||||
CONNECT(con1, localhost, boo1,,foo);
|
||||
DROP TABLE t0;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP DATABASE foo;
|
||||
|
||||
DISCONNECT con1;
|
||||
--CONNECTION default
|
||||
DROP USER boo1;
|
||||
DROP USER boo2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18440: Information_schema.check_constraints possible data leak
|
||||
--echo #
|
||||
|
||||
CREATE USER foo;
|
||||
CREATE DATABASE db;
|
||||
USE db;
|
||||
CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
|
||||
INSERT INTO t1 VALUES (1, 2), (2, 3);
|
||||
GRANT SELECT (a) ON t1 TO foo;
|
||||
|
||||
SHOW GRANTS FOR foo;
|
||||
--sorted_result
|
||||
SELECT * FROM information_schema.check_constraints;
|
||||
|
||||
CONNECT(con1,localhost, foo,, db);
|
||||
SELECT a FROM t1;
|
||||
--sorted_result
|
||||
SELECT * FROM information_schema.check_constraints;
|
||||
|
||||
--CONNECTION default
|
||||
|
||||
DROP USER foo;
|
||||
DROP DATABASE db;
|
||||
|
@ -1092,19 +1092,6 @@ void Aggregator_distinct::endup()
|
||||
}
|
||||
|
||||
|
||||
String *
|
||||
Item_sum_num::val_str(String *str)
|
||||
{
|
||||
return val_string_from_real(str);
|
||||
}
|
||||
|
||||
|
||||
my_decimal *Item_sum_num::val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
return val_decimal_from_real(decimal_value);
|
||||
}
|
||||
|
||||
|
||||
String *
|
||||
Item_sum_int::val_str(String *str)
|
||||
{
|
||||
@ -2183,7 +2170,7 @@ double Stddev::result(bool is_sample_variance)
|
||||
|
||||
|
||||
Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
|
||||
Item_sum_num(thd, item),
|
||||
Item_sum_double(thd, item),
|
||||
m_stddev(item->m_stddev), sample(item->sample),
|
||||
prec_increment(item->prec_increment)
|
||||
{ }
|
||||
@ -2305,13 +2292,6 @@ double Item_sum_variance::val_real()
|
||||
}
|
||||
|
||||
|
||||
my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return val_decimal_from_real(dec_buf);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_variance::reset_field()
|
||||
{
|
||||
double nr;
|
||||
|
@ -587,6 +587,7 @@ public:
|
||||
virtual void setup_caches(THD *thd) {};
|
||||
|
||||
bool with_sum_func() const { return true; }
|
||||
virtual void set_partition_row_count(ulonglong count) { DBUG_ASSERT(0); }
|
||||
};
|
||||
|
||||
|
||||
@ -733,13 +734,33 @@ public:
|
||||
Item_sum_num(THD *thd, Item_sum_num *item):
|
||||
Item_sum(thd, item) {}
|
||||
bool fix_fields(THD *, Item **);
|
||||
longlong val_int() { return val_int_from_real(); /* Real as default */ }
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_double :public Item_sum_num
|
||||
{
|
||||
public:
|
||||
Item_sum_double(THD *thd): Item_sum_num(thd) {}
|
||||
Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
|
||||
Item_sum_double(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
|
||||
Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {}
|
||||
longlong val_int()
|
||||
{
|
||||
return val_int_from_real();
|
||||
}
|
||||
String *val_str(String*str)
|
||||
{
|
||||
return val_string_from_real(str);
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *to)
|
||||
{
|
||||
return val_decimal_from_real(to);
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
|
||||
return get_date_from_real(thd, ltime, fuzzydate);
|
||||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
};
|
||||
|
||||
|
||||
@ -753,6 +774,10 @@ public:
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
return get_date_from_int(thd, ltime, fuzzydate);
|
||||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
bool fix_length_and_dec()
|
||||
{ decimals=0; max_length=21; maybe_null=null_value=0; return FALSE; }
|
||||
@ -794,6 +819,10 @@ public:
|
||||
longlong val_int();
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
void fix_length_and_dec_double();
|
||||
@ -985,7 +1014,7 @@ public:
|
||||
|
||||
|
||||
|
||||
class Item_sum_variance : public Item_sum_num
|
||||
class Item_sum_variance : public Item_sum_double
|
||||
{
|
||||
Stddev m_stddev;
|
||||
bool fix_length_and_dec();
|
||||
@ -995,7 +1024,7 @@ public:
|
||||
uint prec_increment;
|
||||
|
||||
Item_sum_variance(THD *thd, Item *item_par, uint sample_arg):
|
||||
Item_sum_num(thd, item_par),
|
||||
Item_sum_double(thd, item_par),
|
||||
sample(sample_arg)
|
||||
{}
|
||||
Item_sum_variance(THD *thd, Item_sum_variance *item);
|
||||
@ -1005,7 +1034,6 @@ public:
|
||||
void clear();
|
||||
bool add();
|
||||
double val_real();
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
void reset_field();
|
||||
void update_field();
|
||||
Item *result_item(THD *thd, Field *field);
|
||||
@ -1014,11 +1042,10 @@ public:
|
||||
{ return sample ? "var_samp(" : "variance("; }
|
||||
Item *copy_or_same(THD* thd);
|
||||
Field *create_tmp_field(bool group, TABLE *table);
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void cleanup()
|
||||
{
|
||||
m_stddev= Stddev();
|
||||
Item_sum_num::cleanup();
|
||||
Item_sum_double::cleanup();
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_variance>(thd, this); }
|
||||
@ -1725,15 +1752,15 @@ public:
|
||||
|
||||
#else /* Dummy functions to get sql_yacc.cc compiled */
|
||||
|
||||
class Item_sum_udf_float :public Item_sum_num
|
||||
class Item_sum_udf_float :public Item_sum_double
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
:Item_sum_double(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
void clear() {}
|
||||
@ -1743,15 +1770,15 @@ class Item_sum_udf_float :public Item_sum_num
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_udf_int :public Item_sum_num
|
||||
class Item_sum_udf_int :public Item_sum_double
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
:Item_sum_double(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
@ -1762,15 +1789,15 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_udf_decimal :public Item_sum_num
|
||||
class Item_sum_udf_decimal :public Item_sum_double
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
:Item_sum_double(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
@ -1781,15 +1808,15 @@ class Item_sum_udf_decimal :public Item_sum_num
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_udf_str :public Item_sum_num
|
||||
class Item_sum_udf_str :public Item_sum_double
|
||||
{
|
||||
public:
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
|
||||
Item_sum_num(thd) {}
|
||||
Item_sum_double(thd) {}
|
||||
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
:Item_sum_double(thd, item) {}
|
||||
String *val_str(String *)
|
||||
{ DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
|
||||
|
@ -166,28 +166,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_month :public Item_func
|
||||
class Item_func_month :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_month(THD *thd, Item *a): Item_func(thd, a)
|
||||
{ collation.set_numeric(); }
|
||||
Item_func_month(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
{ }
|
||||
longlong val_int();
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
||||
String *val_str(String *str)
|
||||
{
|
||||
longlong nr= val_int();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set(nr, collation.collation);
|
||||
return str;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
return get_date_from_int(thd, ltime, fuzzydate);
|
||||
}
|
||||
const char *func_name() const { return "month"; }
|
||||
const Type_handler *type_handler() const { return &type_handler_long; }
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
@ -440,28 +440,38 @@ class Item_sum_lag : public Item_sum_hybrid_simple
|
||||
{ return get_item_copy<Item_sum_lag>(thd, this); }
|
||||
};
|
||||
|
||||
/*
|
||||
A base window function (aggregate) that also holds a counter for the number
|
||||
of rows.
|
||||
*/
|
||||
class Item_sum_window_with_row_count : public Item_sum_num
|
||||
|
||||
class Partition_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_window_with_row_count(THD *thd) : Item_sum_num(thd),
|
||||
partition_row_count_(0) {}
|
||||
|
||||
Item_sum_window_with_row_count(THD *thd, Item *arg) :
|
||||
Item_sum_num(thd, arg), partition_row_count_(0) {};
|
||||
|
||||
void set_row_count(ulonglong count) { partition_row_count_ = count; }
|
||||
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
protected:
|
||||
public:
|
||||
Partition_row_count() :partition_row_count_(0) { }
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
partition_row_count_ = count;
|
||||
}
|
||||
double calc_val_real(bool *null_value,
|
||||
ulonglong current_row_count)
|
||||
{
|
||||
if ((*null_value= (partition_row_count_ == 0)))
|
||||
return 0;
|
||||
return static_cast<double>(current_row_count) / partition_row_count_;
|
||||
}
|
||||
protected:
|
||||
longlong get_row_count() { return partition_row_count_; }
|
||||
private:
|
||||
ulonglong partition_row_count_;
|
||||
};
|
||||
|
||||
|
||||
class Current_row_count
|
||||
{
|
||||
public:
|
||||
Current_row_count() :current_row_count_(0) { }
|
||||
protected:
|
||||
ulonglong get_row_number() { return current_row_count_ ; }
|
||||
ulonglong current_row_count_;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@detail
|
||||
"The relative rank of a row R is defined as (RK-1)/(NR-1), where RK is
|
||||
@ -473,11 +483,12 @@ class Item_sum_window_with_row_count : public Item_sum_num
|
||||
This is held within the row_count context.
|
||||
- Second pass to compute rank of current row and the value of the function
|
||||
*/
|
||||
class Item_sum_percent_rank: public Item_sum_window_with_row_count
|
||||
class Item_sum_percent_rank: public Item_sum_double,
|
||||
public Partition_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_percent_rank(THD *thd)
|
||||
: Item_sum_window_with_row_count(thd), cur_rank(1), peer_tracker(NULL) {}
|
||||
: Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {}
|
||||
|
||||
longlong val_int()
|
||||
{
|
||||
@ -530,6 +541,14 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
|
||||
}
|
||||
|
||||
void setup_window_func(THD *thd, Window_spec *window_spec);
|
||||
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
Partition_row_count::set_partition_row_count(count);
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_percent_rank>(thd, this); }
|
||||
|
||||
@ -564,25 +583,17 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
|
||||
two passes.
|
||||
*/
|
||||
|
||||
class Item_sum_cume_dist: public Item_sum_window_with_row_count
|
||||
class Item_sum_cume_dist: public Item_sum_double,
|
||||
public Partition_row_count,
|
||||
public Current_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_cume_dist(THD *thd) : Item_sum_window_with_row_count(thd),
|
||||
current_row_count_(0) {}
|
||||
|
||||
Item_sum_cume_dist(THD *thd, Item *arg) : Item_sum_window_with_row_count(thd,arg),
|
||||
current_row_count_(0) {}
|
||||
Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { }
|
||||
Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { }
|
||||
|
||||
double val_real()
|
||||
{
|
||||
if (get_row_count() == 0)
|
||||
{
|
||||
null_value= true;
|
||||
return 0;
|
||||
}
|
||||
ulonglong partition_row_count= get_row_count();
|
||||
null_value= false;
|
||||
return static_cast<double>(current_row_count_) / partition_row_count;
|
||||
return calc_val_real(&null_value, current_row_count_);
|
||||
}
|
||||
|
||||
bool add()
|
||||
@ -599,7 +610,7 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
|
||||
void clear()
|
||||
{
|
||||
current_row_count_= 0;
|
||||
set_row_count(0);
|
||||
partition_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
@ -617,29 +628,26 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
Partition_row_count::set_partition_row_count(count);
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_cume_dist>(thd, this); }
|
||||
|
||||
ulonglong get_row_number()
|
||||
{
|
||||
return current_row_count_ ;
|
||||
}
|
||||
|
||||
private:
|
||||
ulonglong current_row_count_;
|
||||
};
|
||||
|
||||
class Item_sum_ntile : public Item_sum_window_with_row_count
|
||||
class Item_sum_ntile : public Item_sum_int,
|
||||
public Partition_row_count,
|
||||
public Current_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_ntile(THD* thd, Item* num_quantiles_expr) :
|
||||
Item_sum_window_with_row_count(thd, num_quantiles_expr),
|
||||
current_row_count_(0) {};
|
||||
|
||||
double val_real()
|
||||
{
|
||||
return (double) val_int();
|
||||
}
|
||||
Item_sum_int(thd, num_quantiles_expr)
|
||||
{ }
|
||||
|
||||
longlong val_int()
|
||||
{
|
||||
@ -680,7 +688,7 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
|
||||
void clear()
|
||||
{
|
||||
current_row_count_= 0;
|
||||
set_row_count(0);
|
||||
partition_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
@ -690,21 +698,27 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
|
||||
|
||||
void update_field() {}
|
||||
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
Partition_row_count::set_partition_row_count(count);
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_ntile>(thd, this); }
|
||||
|
||||
private:
|
||||
longlong get_num_quantiles() { return args[0]->val_int(); }
|
||||
ulong current_row_count_;
|
||||
};
|
||||
|
||||
class Item_sum_percentile_disc : public Item_sum_cume_dist,
|
||||
public Type_handler_hybrid_field_type
|
||||
class Item_sum_percentile_disc : public Item_sum_num,
|
||||
public Type_handler_hybrid_field_type,
|
||||
public Partition_row_count,
|
||||
public Current_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
|
||||
Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_num(thd, arg),
|
||||
Type_handler_hybrid_field_type(&type_handler_longlong),
|
||||
value(NULL), val_calculated(FALSE), first_call(TRUE),
|
||||
prev_value(0), order_item(NULL){}
|
||||
@ -753,6 +767,17 @@ public:
|
||||
return value->val_str(str);
|
||||
}
|
||||
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
if (get_row_count() == 0 || get_arg(0)->is_null())
|
||||
{
|
||||
null_value= true;
|
||||
return 0;
|
||||
}
|
||||
null_value= false;
|
||||
return value->get_date(thd, ltime, fuzzydate);
|
||||
}
|
||||
|
||||
bool add()
|
||||
{
|
||||
Item *arg= get_arg(0);
|
||||
@ -786,8 +811,8 @@ public:
|
||||
if (value->null_value)
|
||||
return false;
|
||||
|
||||
Item_sum_cume_dist::add();
|
||||
double val= Item_sum_cume_dist::val_real();
|
||||
current_row_count_++;
|
||||
double val= calc_val_real(&null_value, current_row_count_);
|
||||
|
||||
if (val >= prev_value && !val_calculated)
|
||||
val_calculated= true;
|
||||
@ -804,7 +829,8 @@ public:
|
||||
val_calculated= false;
|
||||
first_call= true;
|
||||
value->clear();
|
||||
Item_sum_cume_dist::clear();
|
||||
partition_row_count_= 0;
|
||||
current_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
@ -813,7 +839,6 @@ public:
|
||||
}
|
||||
|
||||
void update_field() {}
|
||||
void set_type_handler(Window_spec *window_spec);
|
||||
const Type_handler *type_handler() const
|
||||
{return Type_handler_hybrid_field_type::type_handler();}
|
||||
|
||||
@ -824,6 +849,13 @@ public:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
Partition_row_count::set_partition_row_count(count);
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_percentile_disc>(thd, this); }
|
||||
void setup_window_func(THD *thd, Window_spec *window_spec);
|
||||
@ -838,12 +870,12 @@ private:
|
||||
Item *order_item;
|
||||
};
|
||||
|
||||
class Item_sum_percentile_cont : public Item_sum_cume_dist,
|
||||
public Type_handler_hybrid_field_type
|
||||
class Item_sum_percentile_cont : public Item_sum_double,
|
||||
public Partition_row_count,
|
||||
public Current_row_count
|
||||
{
|
||||
public:
|
||||
Item_sum_percentile_cont(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
|
||||
Type_handler_hybrid_field_type(&type_handler_double),
|
||||
Item_sum_percentile_cont(THD *thd, Item* arg) : Item_sum_double(thd, arg),
|
||||
floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0),
|
||||
ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){}
|
||||
|
||||
@ -913,7 +945,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
Item_sum_cume_dist::add();
|
||||
current_row_count_++;
|
||||
double val= 1 + prev_value * (get_row_count()-1);
|
||||
|
||||
if (!floor_val_calculated && get_row_number() == floor(val))
|
||||
@ -936,7 +968,8 @@ public:
|
||||
ceil_value->clear();
|
||||
floor_val_calculated= false;
|
||||
ceil_val_calculated= false;
|
||||
Item_sum_cume_dist::clear();
|
||||
partition_row_count_= 0;
|
||||
current_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
@ -944,9 +977,6 @@ public:
|
||||
return "percentile_cont";
|
||||
}
|
||||
void update_field() {}
|
||||
void set_type_handler(Window_spec *window_spec);
|
||||
const Type_handler *type_handler() const
|
||||
{return Type_handler_hybrid_field_type::type_handler();}
|
||||
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
@ -955,6 +985,13 @@ public:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void reset_field() { DBUG_ASSERT(0); }
|
||||
|
||||
void set_partition_row_count(ulonglong count)
|
||||
{
|
||||
Partition_row_count::set_partition_row_count(count);
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_percentile_cont>(thd, this); }
|
||||
void setup_window_func(THD *thd, Window_spec *window_spec);
|
||||
|
@ -6908,23 +6908,35 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
|
||||
thd->clear_error();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else if (!tables->view)
|
||||
if (!tables->view)
|
||||
{
|
||||
if (tables->table->s->table_check_constraints)
|
||||
StringBuffer<MAX_FIELD_WIDTH> str(system_charset_info);
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
TABLE_LIST table_acl_check;
|
||||
bzero((char*) &table_acl_check, sizeof(table_acl_check));
|
||||
#endif
|
||||
for (uint i= 0; i < tables->table->s->table_check_constraints; i++)
|
||||
{
|
||||
for (uint i= 0; i < tables->table->s->table_check_constraints; i++)
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (!(thd->col_access & TABLE_ACLS))
|
||||
{
|
||||
StringBuffer<MAX_FIELD_WIDTH> str(system_charset_info);
|
||||
Virtual_column_info *check= tables->table->check_constraints[i];
|
||||
restore_record(table, s->default_values);
|
||||
table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
|
||||
table->field[1]->store(db_name->str, db_name->length, system_charset_info);
|
||||
table->field[2]->store(check->name.str, check->name.length, system_charset_info);
|
||||
table->field[3]->store(table_name->str, table_name->length, system_charset_info);
|
||||
check->print(&str);
|
||||
table->field[4]->store(str.ptr(), str.length(), system_charset_info);
|
||||
schema_table_store_record(thd, table);
|
||||
table_acl_check.db= *db_name;
|
||||
table_acl_check.table_name= *table_name;
|
||||
table_acl_check.grant.privilege= thd->col_access;
|
||||
if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
Virtual_column_info *check= tables->table->check_constraints[i];
|
||||
table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
|
||||
table->field[3]->store(check->name.str, check->name.length,
|
||||
system_charset_info);
|
||||
/* Make sure the string is empty between each print. */
|
||||
str.length(0);
|
||||
check->print(&str);
|
||||
table->field[4]->store(str.ptr(), str.length(), system_charset_info);
|
||||
if (schema_table_store_record(thd, table))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
@ -9847,9 +9859,9 @@ ST_FIELD_INFO check_constraints_fields_info[]=
|
||||
{"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
|
||||
{"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
|
||||
OPEN_FULL_TABLE},
|
||||
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
|
||||
{"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
|
||||
OPEN_FULL_TABLE},
|
||||
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
|
||||
{"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
|
||||
OPEN_FULL_TABLE},
|
||||
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
|
||||
@ -9873,8 +9885,8 @@ ST_SCHEMA_TABLE schema_tables[]=
|
||||
fill_schema_applicable_roles, 0, 0, -1, -1, 0, 0},
|
||||
{"CHARACTER_SETS", charsets_fields_info, 0,
|
||||
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
|
||||
{"CHECK_CONSTRAINTS", check_constraints_fields_info, 0,
|
||||
get_all_tables, 0, get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
|
||||
{"CHECK_CONSTRAINTS", check_constraints_fields_info, 0, get_all_tables, 0,
|
||||
get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
|
||||
{"COLLATIONS", collation_fields_info, 0,
|
||||
fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
|
||||
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
|
||||
|
@ -1779,11 +1779,7 @@ protected:
|
||||
List_iterator_fast<Item_sum> it(sum_functions);
|
||||
Item_sum* item;
|
||||
while ((item= it++))
|
||||
{
|
||||
Item_sum_window_with_row_count* item_with_row_count =
|
||||
static_cast<Item_sum_window_with_row_count *>(item);
|
||||
item_with_row_count->set_row_count(num_rows_in_partition);
|
||||
}
|
||||
item->set_partition_row_count(num_rows_in_partition);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -127,14 +127,6 @@ mlog_catenate_string(
|
||||
const byte* str, /*!< in: string to write */
|
||||
ulint len); /*!< in: string length */
|
||||
/********************************************************//**
|
||||
Catenates a compressed ulint to mlog. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
mlog_catenate_ulint_compressed(
|
||||
/*===========================*/
|
||||
mtr_t* mtr, /*!< in: mtr */
|
||||
ulint val); /*!< in: value to write */
|
||||
/********************************************************//**
|
||||
Catenates a compressed 64-bit integer to mlog. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
|
@ -117,30 +117,6 @@ mlog_catenate_ulint(
|
||||
mlog_catenate_ulint(mtr->get_log(), val, type);
|
||||
}
|
||||
|
||||
/********************************************************//**
|
||||
Catenates a compressed ulint to mlog. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
mlog_catenate_ulint_compressed(
|
||||
/*===========================*/
|
||||
mtr_t* mtr, /*!< in: mtr */
|
||||
ulint val) /*!< in: value to write */
|
||||
{
|
||||
byte* log_ptr;
|
||||
|
||||
log_ptr = mlog_open(mtr, 10);
|
||||
|
||||
/* If no logging is requested, we may return now */
|
||||
if (log_ptr == NULL) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
log_ptr += mach_write_compressed(log_ptr, val);
|
||||
|
||||
mlog_close(mtr, log_ptr);
|
||||
}
|
||||
|
||||
/********************************************************//**
|
||||
Catenates a compressed 64-bit integer to mlog. */
|
||||
UNIV_INLINE
|
||||
|
Reference in New Issue
Block a user