mark some file to been opensource for ce-farm
This commit is contained in:
26
tools/deploy/mysql_test/t/a_trade_notify.test
Normal file
26
tools/deploy/mysql_test/t/a_trade_notify.test
Normal file
@ -0,0 +1,26 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: trade notify
|
||||
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
--real_sleep 5
|
||||
--enable_query_log
|
||||
--source mysql_test/include/a_trade_schema_drop.inc
|
||||
--source mysql_test/include/a_trade_schema_create.inc
|
||||
--echo merge happens
|
||||
insert into notify_history_000(id,plugin,parameter,group_no,status,gmt_create,gmt_modify) values('1111','1','1bdc',-2,'1','2014-09-19 12:00:00','2014-09-19 11:11:11');
|
||||
insert into notify_history_000(id,plugin,parameter,group_no,status,gmt_create,gmt_modify) values('2111','1','1bdc',-2,'1','2014-09-19 12:00:00','2014-09-19 11:11:11');
|
||||
insert into notify_history_000(id,plugin,parameter,group_no,status,gmt_create,gmt_modify) values('3111','1','1bdc',-2,'1','2014-09-19 12:00:00','2014-09-19 11:11:11');
|
||||
update notify_history_000 set group_no=-1 , iw_user_id = '1111' , status ='N';
|
||||
select id from notify_history_000 where group_no = -1 and iw_user_id = '1111';
|
||||
select id, plugin, plugin_host, parameter, group_no, status, gmt_create, gmt_local_create, gmt_modify, iw_user_id, channel_endpoint, business_order, business_type from notify_000 where (id = '1111') for update;
|
||||
select id, plugin, plugin_host, parameter, group_no, status, gmt_create, gmt_local_create, gmt_modify, iw_user_id, channel_endpoint, business_order, business_type from notify_000 where ((id = '1111') AND (status IN ('N', 'C')));
|
||||
select id, plugin, plugin_host, parameter, group_no, status, gmt_create, gmt_local_create, gmt_modify, iw_user_id, channel_endpoint, business_order, business_type from notify_000 where ((id = '1111') AND (status IN ('N', 'C'))) for update;
|
||||
select /* QUERY_TIMEOUT(15000000) */ id from notify_000 where gmt_create <= current_timestamp() and gmt_create >= date_sub(current_timestamp(), INTERVAL 6 MINUTE) and gmt_modify < now() and status in ('N', 'C') and group_no != -1;
|
||||
select /* QUERY_TIMEOUT(15000000) */ id from notify_000 where gmt_create <= current_timestamp() and gmt_create >= date_sub(current_timestamp(), INTERVAL 6 MINUTE) and gmt_modify < now() and status in ('N', 'C') and group_no = -1;
|
||||
select /* QUERY_TIMEOUT(15000000) */ id, business_order, business_type from notify_000 where gmt_create <= current_timestamp() AND gmt_create >= date_sub(current_timestamp(), INTERVAL 6 MINUTE) AND ((status = 'N') AND (gmt_modify < current_timestamp())) limit 1;
|
||||
select id, plugin, plugin_host, parameter, group_no, status, gmt_create, gmt_local_create, gmt_modify, iw_user_id, channel_endpoint, business_order, business_type from notify_000 where (iw_user_id ='1111') and (gmt_create < current_timestamp()) and (gmt_create >= current_timestamp());
|
||||
delete from notify_history_000 where ((group_no = (- 1)) AND (iw_user_id = '1111'));
|
||||
761
tools/deploy/mysql_test/t/a_trade_quick.test
Normal file
761
tools/deploy/mysql_test/t/a_trade_quick.test
Normal file
@ -0,0 +1,761 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: ddl
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE if exists trade_sequence_000;
|
||||
DROP TABLE if exists BUSINESS_ACTION_000;
|
||||
DROP TABLE if exists BUSINESS_ACTIVITY_000;
|
||||
DROP TABLE if exists NOTIFY_000 ;
|
||||
DROP TABLE if exists NOTIFY_HISTORY_000 ;
|
||||
DROP TABLE if exists TIMEOUT_000 ;
|
||||
DROP TABLE if exists TIMEOUT_HISTORY_000 ;
|
||||
DROP TABLE if exists TIMEOUT_LONG_000 ;
|
||||
DROP TABLE if exists TIMEOUT_REMIND_000;
|
||||
DROP TABLE if exists TRADE_BASE_000 ;
|
||||
DROP TABLE if exists TRADE_CHARGE_000;
|
||||
DROP TABLE if exists TRADE_EXT_000 ;
|
||||
DROP TABLE if exists TRADE_FUND_BILL_000 ;
|
||||
DROP TABLE if exists TRADE_GOODS_INFO_000 ;
|
||||
DROP TABLE if exists TRADE_LOGISTICS_000;
|
||||
DROP TABLE if exists TRADE_MESSAGE_BOARD_000 ;
|
||||
DROP TABLE if exists TRADE_NOTE_000 ;
|
||||
DROP TABLE if exists TRADE_OUTTRADE_000 ;
|
||||
DROP TABLE if exists TRADE_PAYMENT_CLAUSE_000 ;
|
||||
DROP TABLE if exists TRADE_PAYMENT_ORDER_000 ;
|
||||
DROP TABLE if exists TRADE_PROCESS_000 ;
|
||||
DROP TABLE if exists TRADE_REFUND_000 ;
|
||||
DROP TABLE if exists TRADE_VOUCHER_000 ;
|
||||
DROP TABLE if exists TRADE_RECEIVE_ADDRESS_000;
|
||||
DROP TABLE if exists TRADE_COOPERATE_000;
|
||||
DROP TABLE if exists TRADE_SETTLE_ORDER_000;
|
||||
DROP TABLE if exists TRADE_PARTICIPANT_000;
|
||||
DROP TABLE if exists BUSINESS_ACTIVITY_ASYNC_000;
|
||||
DROP TABLE if exists EXTERFACE_INVOKE_000;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE if not exists trade_sequence_000
|
||||
(
|
||||
name varchar(256),
|
||||
value int,
|
||||
min_value int,
|
||||
max_value int,
|
||||
step int,
|
||||
gmt_create TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
gmt_modified TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
primary key (name)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
|
||||
CREATE TABLE if not exists BUSINESS_ACTION_000
|
||||
(
|
||||
ACTION_ID int NOT NULL,
|
||||
TX_ID varchar(128) NOT NULL,
|
||||
NAME varchar(64) NOT NULL,
|
||||
STATE CHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP NOT NULL,
|
||||
CONTEXT varchar(4000),
|
||||
primary key (ACTION_ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists BUSINESS_ACTIVITY_000
|
||||
(
|
||||
TX_ID varchar(128) NOT NULL,
|
||||
STATE VARCHAR(1) NOT NULL,
|
||||
ACCOUNT_TRANS_STATE VARCHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP NOT NULL,
|
||||
PROPAGATION VARCHAR(1),
|
||||
CONTEXT varchar(2048),
|
||||
primary key (TX_ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists NOTIFY_000
|
||||
(
|
||||
ID varchar(34) NOT NULL,
|
||||
PLUGIN varchar(50) NOT NULL,
|
||||
PARAMETER varchar(4000) NOT NULL,
|
||||
GROUP_NO int NOT NULL,
|
||||
STATUS VARCHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFY TIMESTAMP NOT NULL,
|
||||
IW_USER_ID varchar(16),
|
||||
CHANNEL_ENDPOINT varchar(200),
|
||||
BUSINESS_ORDER varchar(128),
|
||||
BUSINESS_TYPE varchar(50),
|
||||
PLUGIN_HOST varchar(15),
|
||||
GMT_LOCAL_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
primary key (id)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX NOTIFY_BUSINESS_ORDER1_IND ON NOTIFY_000 (BUSINESS_ORDER);
|
||||
CREATE INDEX NOTIFY_PLUGIN_IND ON NOTIFY_000 (PLUGIN, CHANNEL_ENDPOINT);
|
||||
|
||||
CREATE TABLE if not exists NOTIFY_HISTORY_000
|
||||
(
|
||||
ID varchar(34) NOT NULL,
|
||||
PLUGIN varchar(50) NOT NULL,
|
||||
PARAMETER varchar(4000) NOT NULL,
|
||||
GROUP_NO int NOT NULL,
|
||||
STATUS VARCHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFY TIMESTAMP NOT NULL,
|
||||
IW_USER_ID varchar(16),
|
||||
CHANNEL_ENDPOINT varchar(200),
|
||||
BUSINESS_ORDER varchar(128),
|
||||
BUSINESS_TYPE varchar(50),
|
||||
PLUGIN_HOST varchar(15),
|
||||
GMT_LOCAL_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX NOTIFY_HISTORY_000_BORDER_IND ON NOTIFY_HISTORY_000 (BUSINESS_ORDER);
|
||||
CREATE INDEX NOTIFY_HISTORY_IG_IND ON NOTIFY_HISTORY_000 (IW_USER_ID, GROUP_NO);
|
||||
|
||||
CREATE TABLE if not exists TIMEOUT_000
|
||||
(
|
||||
JOB_ID varchar(32) NOT NULL,
|
||||
TRADE_NO varchar(64),
|
||||
USER_ID varchar(128),
|
||||
PAYTYPE varchar(4),
|
||||
END_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ACTION varchar(30),
|
||||
PARAMETER varchar(100),
|
||||
STATUS VARCHAR(1),
|
||||
ACTION_TYPE VARCHAR(1),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIOR_LEVEL int default 1,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_OCCUR TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (JOB_ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX IND_BEYOND_TIMEOUT_ETIME ON TIMEOUT_000 (END_TIME);
|
||||
CREATE INDEX TIMEOUT_000_PL_IND ON TIMEOUT_000 (PRIOR_LEVEL);
|
||||
CREATE INDEX TIMEOUT_TNO_IND ON TIMEOUT_000 (TRADE_NO);
|
||||
|
||||
CREATE TABLE if not exists TIMEOUT_HISTORY_000
|
||||
(
|
||||
JOB_ID varchar(32) NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
USER_ID varchar(128),
|
||||
PAYTYPE varchar(4),
|
||||
END_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ACTION varchar(30),
|
||||
PARAMETER varchar(100),
|
||||
STATUS VARCHAR(1),
|
||||
ACTION_TYPE VARCHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIOR_LEVEL int,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_OCCUR TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (JOB_ID, TRADE_NO, ACTION_TYPE)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists TIMEOUT_LONG_000
|
||||
(
|
||||
JOB_ID varchar(32) NOT NULL,
|
||||
TRADE_NO varchar(64),
|
||||
USER_ID varchar(128),
|
||||
PAYTYPE varchar(4),
|
||||
END_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ACTION varchar(30),
|
||||
PARAMETER varchar(100),
|
||||
STATUS VARCHAR(1),
|
||||
ACTION_TYPE VARCHAR(1),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIOR_LEVEL int ,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_OCCUR TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (JOB_ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX BYD_TIMEOUT_LONG_ENDTIME_IND ON TIMEOUT_LONG_000 (END_TIME);
|
||||
CREATE INDEX TIMEOUT_LONG_000_PL_IND ON TIMEOUT_LONG_000 (PRIOR_LEVEL);
|
||||
CREATE INDEX TIMEOUT_LONG_TNO_IND ON TIMEOUT_LONG_000 (TRADE_NO);
|
||||
|
||||
|
||||
CREATE TABLE if not exists TIMEOUT_REMIND_000
|
||||
(
|
||||
JOB_ID varchar(32) NOT NULL,
|
||||
TRADE_NO varchar(64),
|
||||
USER_ID varchar(128),
|
||||
PAYTYPE varchar(4),
|
||||
END_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ACTION varchar(30),
|
||||
PARAMETER varchar(100),
|
||||
STATUS VARCHAR(1),
|
||||
ACTION_TYPE VARCHAR(1),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIOR_LEVEL int ,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_OCCUR TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (JOB_ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
|
||||
CREATE INDEX BY_TIMEOUT_REMIND_ETIME_IND ON TIMEOUT_REMIND_000 (END_TIME);
|
||||
|
||||
CREATE INDEX TIMEOUT_REMIND_000_PL_IND ON TIMEOUT_REMIND_000 (PRIOR_LEVEL);
|
||||
|
||||
CREATE INDEX TIMEOUT_REMIND_TNO_IND ON TIMEOUT_REMIND_000 (TRADE_NO);
|
||||
|
||||
CREATE TABLE if not exists TRADE_BASE_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
OUT_TRADE_NO varchar(64),
|
||||
SELLER_ACCOUNT varchar(100) NOT NULL,
|
||||
SELLER_LOGIN_EMAIL varchar(100) NOT NULL,
|
||||
BUYER_ACCOUNT varchar(100) NOT NULL,
|
||||
BUYER_LOGIN_EMAIL varchar(100) NOT NULL,
|
||||
SELLER_TYPE int,
|
||||
BUYER_TYPE int,
|
||||
TRADE_FROM varchar(100),
|
||||
TRADE_EMAIL varchar(100),
|
||||
OPERATOR_ROLE VARCHAR(1) NOT NULL,
|
||||
TRADE_STATUS varchar(50) NOT NULL,
|
||||
TOTAL_FEE int default 0 NOT NULL,
|
||||
SERVICE_FEE_RATIO varchar(64),
|
||||
SERVICE_FEE int default 0 NOT NULL,
|
||||
CURRENCY varchar(3),
|
||||
SELLER_ACTION varchar(200),
|
||||
BUYER_ACTION varchar(200),
|
||||
GMT_CREATE TIMESTAMP ,
|
||||
SELLER_USER_ID varchar(16),
|
||||
BUYER_USER_ID varchar(16),
|
||||
ADDITIONAL_TRD_STATUS varchar(50),
|
||||
TRADE_TYPE varchar(4) NOT NULL,
|
||||
SELLER_FULLNAME varchar(256) default '',
|
||||
BUYER_FULLNAME varchar(256) default '',
|
||||
SELLER_NICK varchar(100) default '' NOT NULL,
|
||||
BUYER_NICK varchar(100) default '' NOT NULL,
|
||||
GOODS_TITLE varchar(256),
|
||||
GMT_LAST_MODIFIED_DT TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
STOP_TIMEOUT varchar(4) default '0',
|
||||
GATHERING_TYPE varchar(4),
|
||||
BUYER_MARKER VARCHAR(1),
|
||||
SELLER_MARKER VARCHAR(1),
|
||||
BUYER_MARKER_MEMO varchar(1000),
|
||||
SELLER_MARKER_MEMO varchar(1000),
|
||||
CHANNEL varchar(32),
|
||||
PRODUCT varchar(20),
|
||||
PAY_CHANNEL varchar(32),
|
||||
OTHER_SERVICE_FEE int,
|
||||
RELATION_PRO varchar(64),
|
||||
PLATFORM varchar(100),
|
||||
CHANNEL_PARTNER varchar(100),
|
||||
GOODS_TYPE VARCHAR(4),
|
||||
GOODS_SUB_TYPE VARCHAR(4),
|
||||
PRIMARY KEY (TRADE_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX BYD_TRADE_BASE_TEMAIL_GMTC_IND ON TRADE_BASE_000
|
||||
(TRADE_EMAIL, GMT_CREATE);
|
||||
|
||||
CREATE INDEX IND_BEYOND_TRADE_BASE_BUYGMT1 ON TRADE_BASE_000
|
||||
(BUYER_ACCOUNT, GMT_CREATE);
|
||||
|
||||
CREATE INDEX IND_BEYOND_TRADE_BASE_SALGMT1 ON TRADE_BASE_000
|
||||
(SELLER_ACCOUNT, GMT_CREATE);
|
||||
|
||||
CREATE TABLE if not exists TRADE_CHARGE_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
GMT_CHARGE TIMESTAMP NOT NULL,
|
||||
GMT_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
CHARGE_OUT_DATE VARCHAR(8),
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PLAN_CHARGE int,
|
||||
ACTUAL_CHARGE int,
|
||||
RATE_ID int,
|
||||
RATE int,
|
||||
RATE_ORIGIN VARCHAR(1),
|
||||
PRODUCT_NAME varchar(32),
|
||||
CHARGE_TYPE varchar(16),
|
||||
SERVICE_EVENT_ID int,
|
||||
PAYMENT_BILL_ID int,
|
||||
SALES_ID int,
|
||||
PARTNER_ID varchar(30),
|
||||
DEBIT_ACCOUNT varchar(20),
|
||||
CREDIT_ACCOUNT varchar(20),
|
||||
BILL_STATUS VARCHAR(1),
|
||||
SERVICE_AMOUNT int,
|
||||
TRADE_FROM varchar(100),
|
||||
DEBIT_USER_ID varchar(16),
|
||||
SERVICT_TYPE varchar(8),
|
||||
SUB_TRADE_NO varchar(64),
|
||||
primary key (TRADE_NO, SERVICT_TYPE, CHARGE_TYPE, SUB_TRADE_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX TRADE_CHARGE_000_GMT_IND ON TRADE_CHARGE_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_EXT_000
|
||||
(
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
EXT_INFO varchar(1000),
|
||||
TRADE_AGENT varchar(30),
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
FP_TIME_OUT_RULE varchar(1000),
|
||||
FOREX_RATE_ID int,
|
||||
FOREX_CURRENCY varchar(8),
|
||||
FOREX_TOTAL_FEE int,
|
||||
GOODS_INNER_SELL_RATE int,
|
||||
PREPARE_COUPON_FEE int,
|
||||
PREPARE_COUPON_LIST varchar(64),
|
||||
FOREX_CERT_NO varchar(128),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
AUTH_DEBIT_TYPE varchar(1),
|
||||
SUPPORT_CREDIT_CARD varchar(256),
|
||||
SPECIFIED_PAY_CHANNEL varchar(128),
|
||||
CHARGE_CHANNEL_INFO varchar(256),
|
||||
PAY_CHANNELS varchar(900),
|
||||
PRIMARY KEY (TRADE_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX TRADE_EXT_000_GMT_IND ON TRADE_EXT_000 (GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_FUND_BILL_000
|
||||
(
|
||||
BILL_NO varchar(128) NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
PAY_ACCOUNT_NO varchar(20) NOT NULL,
|
||||
RECEIVE_ACCOUNT_NO varchar(20) NOT NULL,
|
||||
CURRENCY varchar(3) default '156' NOT NULL,
|
||||
AMOUNT int NOT NULL,
|
||||
TYPE VARCHAR(2) NOT NULL,
|
||||
STATUS VARCHAR(1) NOT NULL,
|
||||
CHANNEL VARCHAR(2) NOT NULL,
|
||||
GMT_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
IW_TRANS_LOG_ID int,
|
||||
GMT_TRADE_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP NOT NULL,
|
||||
MEMO varchar(1000),
|
||||
BANK_PAY_ONLINE_ID int,
|
||||
BANK_AMOUNT int,
|
||||
BANK_TYPE varchar(32),
|
||||
FREEZE_TYPE varchar(5),
|
||||
OUT_ORDER_NO varchar(64),
|
||||
PARTNER_ID varchar(30),
|
||||
DEPOSIT_ID varchar(16),
|
||||
BILL_EXT varchar(200),
|
||||
PAY_ORDER_NO varchar(64),
|
||||
primary key (TRADE_NO,BILL_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX BYD_TRADE_FUND_BILL_PF_IND ON TRADE_FUND_BILL_000(PAY_ACCOUNT_NO, GMT_TRADE_CREATE);
|
||||
|
||||
CREATE INDEX BYD_TRADE_FUND_BILL_RF_IND ON TRADE_FUND_BILL_000(RECEIVE_ACCOUNT_NO, GMT_TRADE_CREATE);
|
||||
|
||||
CREATE INDEX TRADE_FUND_BILL_PTG_IND ON TRADE_FUND_BILL_000 (PARTNER_ID, GMT_TRADE_CREATE);
|
||||
|
||||
CREATE INDEX TRADE_FUND_BILL_000_GMT_IND ON TRADE_FUND_BILL_000(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_GOODS_INFO_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
GOODS_ID varchar(32) default ' ' NOT NULL,
|
||||
GOODS_TITLE varchar(256),
|
||||
GOODS_BID int default 0 NOT NULL,
|
||||
GOODS_QUANTITY int default 1 NOT NULL,
|
||||
DETAIL_URL varchar(400),
|
||||
GOODS_MEMO varchar(1000),
|
||||
REFER_URL varchar(400),
|
||||
PARTNER varchar(100),
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
OTHER_FEE int,
|
||||
CATEGORY varchar(24),
|
||||
PROMOTION_DESC varchar(256),
|
||||
PIC_URL varchar(400),
|
||||
GOODS_TYPE VARCHAR(4),
|
||||
GOODS_SUB_TYPE VARCHAR(4),
|
||||
primary key (TRADE_NO, ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists TRADE_LOGISTICS_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO VARCHAR(64) NOT NULL,
|
||||
LOGISTICS_ID VARCHAR(20),
|
||||
LOGISTICS_NAME VARCHAR(128),
|
||||
INVOICE_NO VARCHAR(64),
|
||||
SIGN_VOUCHER_NO VARCHAR(64),
|
||||
TRANSPORT_TYPE int,
|
||||
TRANSPORT_FEE int default 0 NOT NULL,
|
||||
OTHER_FEE int default 0,
|
||||
ADDITIONAL_SERVICE VARCHAR(300),
|
||||
LOGISTICS_STATUS VARCHAR(100),
|
||||
SEND_FULLNAME VARCHAR(256),
|
||||
SEND_PHONE VARCHAR(30),
|
||||
SEND_MOBILE_PHONE VARCHAR(30),
|
||||
SEND_ADDRESS VARCHAR(256),
|
||||
SEND_POST VARCHAR(20),
|
||||
RECEIVE_FULLNAME VARCHAR(256),
|
||||
RECEIVE_PHONE VARCHAR(30),
|
||||
RECEIVE_MOBILE_PHONE VARCHAR(30),
|
||||
RECEIVE_ADDRESS VARCHAR(256),
|
||||
RECEIVE_POST VARCHAR(20),
|
||||
LOGISTICS_MEMO VARCHAR(600),
|
||||
TRADE_OR_REFUND_FLAG int default 1 NOT NULL,
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_APPLY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_FETCH TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_TRANSPORT TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_SIGN TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
SEND_IM_TYPE VARCHAR(10),
|
||||
SEND_IM_ID VARCHAR(100),
|
||||
RECEIVE_IM_TYPE VARCHAR(10),
|
||||
RECEIVE_IM_ID VARCHAR(100),
|
||||
TRANSPORT_PAYMENT int,
|
||||
TRANSPORT_MODIFIABLE int,
|
||||
RECEIVE_ADDRESS_CODE VARCHAR(8),
|
||||
SEND_ADDRESS_CODE VARCHAR(8),
|
||||
TRANSPORT_TYPE_SEND int,
|
||||
LOGISTICS_NO VARCHAR(100),
|
||||
TRANS_GOODS_INFO VARCHAR(400),
|
||||
REC_ADDRESS_NO VARCHAR(100),
|
||||
FLAG_MAIN int,
|
||||
primary key (TRADE_NO, TRADE_OR_REFUND_FLAG, ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX TRADE_LOGISTICS_000_GMT_IND ON TRADE_LOGISTICS_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
|
||||
#这个表修改了IS_READ,原来使用的是CHAR(1)
|
||||
CREATE TABLE if not exists TRADE_MESSAGE_BOARD_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
MESSAGE varchar(2000) NOT NULL,
|
||||
POSTER varchar(100) default ' ' NOT NULL,
|
||||
POSTER_ROLE int,
|
||||
OPERATOR_IP varchar(15),
|
||||
MSG_TYPE int default 0,
|
||||
IS_READ int default 0 NOT NULL,
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (TRADE_NO, ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists TRADE_NOTE_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
TRADE_STATUS varchar(64) default ' ',
|
||||
BUYER_EMAIL varchar(100) default ' ' NOT NULL,
|
||||
SELLER_EMAIL varchar(100) default ' ' NOT NULL,
|
||||
OPERATOR_EMAIL varchar(100) default ' ' NOT NULL,
|
||||
OPERATOR_IP varchar(15),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
OPERATOR_MEMO varchar(256),
|
||||
NOTE_TYPE varchar(100),
|
||||
REMOTE_MAC varchar(64),
|
||||
primary key (TRADE_NO, ID, GMT_CREATE)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists TRADE_OUTTRADE_000
|
||||
(
|
||||
PARTNER_ID varchar(200) NOT NULL,
|
||||
OUT_TRADE_NO varchar(64) NOT NULL,
|
||||
TRADE_FROM varchar(100) NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
primary key (OUT_TRADE_NO, PARTNER_ID, TRADE_FROM)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists TRADE_PAYMENT_CLAUSE_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
OUT_RELATION_ID varchar(64),
|
||||
SERIAL_NO int,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PAYMENT_TYPE varchar(64) NOT NULL,
|
||||
STATUS varchar(50),
|
||||
PAY_ACCOUNT_NO varchar(20),
|
||||
PAY_USER_ID varchar(16),
|
||||
RECEIVE_ACCOUNT_NO varchar(20),
|
||||
RECEIVE_USER_ID varchar(16),
|
||||
AMOUNT int,
|
||||
CURRENCY varchar(64),
|
||||
PAYMENT_RESTRICT_RULE varchar(1000),
|
||||
DESCRIPTION varchar(1000),
|
||||
MEMO varchar(1000),
|
||||
CONTEXT varchar(1000),
|
||||
primary key (TRADE_NO, OUT_RELATION_ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX TRADE_PCLAUSE_000_GMT_IND ON TRADE_PAYMENT_CLAUSE_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_PAYMENT_ORDER_000
|
||||
(
|
||||
ORDER_NO varchar(64) NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
BIZ_TYPE varchar(20) NOT NULL,
|
||||
OUT_ORDER_NO varchar(64),
|
||||
GMT_MODIFIED TIMESTAMP NOT NULL,
|
||||
STATUS varchar(2) NOT NULL,
|
||||
PAY_ACCOUNT_NO varchar(20) NOT NULL,
|
||||
RECEIVE_ACCOUNT_NO varchar(20) NOT NULL,
|
||||
AMOUNT int NOT NULL,
|
||||
RETURN_AMOUNT int,
|
||||
CURRENCY varchar(3) NOT NULL,
|
||||
FREEZE_TYPE varchar(5),
|
||||
EXT_INFO varchar(1000),
|
||||
MEMO varchar(1000),
|
||||
PAYMENT_ID varchar(64),
|
||||
PAYMENT_CONTEXT varchar(1000),
|
||||
GMT_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
FREEZE_AMOUNT int,
|
||||
SUB_TRANS_CODE varchar(40) NOT NULL,
|
||||
primary key (TRADE_NO, ORDER_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX TRADE_PAYMENT_ORD_000_GM_IND ON TRADE_PAYMENT_ORDER_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_PROCESS_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) default ' ' NOT NULL,
|
||||
OUT_TRADE_NO varchar(64),
|
||||
RECEIVE_FEE int default 0 NOT NULL,
|
||||
SEND_FEE int default 0 NOT NULL,
|
||||
ADJUST_FEE int default 0 NOT NULL,
|
||||
MEMO varchar(600),
|
||||
OPERATE_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
OPERATE_NAME varchar(256),
|
||||
FLAG_REFUND varchar(4) default '0' NOT NULL,
|
||||
FLAG_DEFERPAY varchar(4) default '0' NOT NULL,
|
||||
FLAG_PAYMENT varchar(8) default '0' NOT NULL,
|
||||
FLAG_TRADE_LOCKED varchar(4) default '0' NOT NULL,
|
||||
FLAG_SELLER_MDF varchar(4) default '0' NOT NULL,
|
||||
GMT_CREATE TIMESTAMP ,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_RECEIVE_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_SEND_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_SEND_GOODS TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
TIME_OUT_RULE varchar(1000),
|
||||
GMT_OUT_TRADE_NO_CREATED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
COUPON_CLEAR_FEE int,
|
||||
COUPON_ADJUST_FEE int,
|
||||
REFUND_FEE int,
|
||||
GMT_REFUND_PAY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_FINISH TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ACCOUNT_TX_ID varchar(40),
|
||||
ADJUST_TIMEOUT int,
|
||||
GMT_PRE_AUTH TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRE_AUTH_FEE int,
|
||||
ACTUAL_ADJUST_FEE int,
|
||||
EXPIRE_TIME TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
SEND_BACK_FEE int,
|
||||
PRIMARY KEY (TRADE_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX IND_BYD_TRD_PROCESS_GRPAY ON TRADE_PROCESS_000
|
||||
(GMT_RECEIVE_PAY, RECEIVE_FEE);
|
||||
|
||||
CREATE INDEX TRADE_PROCESS_GMT_IND ON TRADE_PROCESS_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_REFUND_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) NOT NULL,
|
||||
OUT_TRADE_NO varchar(64),
|
||||
RETURN_STATUS varchar(100),
|
||||
MEMO varchar(2000),
|
||||
RETURN_FEE int,
|
||||
GMT_ADMIN_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
ADMIN_STATUS varchar(100),
|
||||
RETURN_TYPE varchar(20) NOT NULL,
|
||||
RETURN_GOODS int,
|
||||
GOODS_STATUS int,
|
||||
CLOSE_CAUSE varchar(600),
|
||||
REQUIRE_VOUCHER int,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
SELLER_NOT_RECEIVE int,
|
||||
REFUND_REASON varchar(400),
|
||||
APPEAL_NO varchar(50),
|
||||
GMT_DW_SYNC TIMESTAMP ,
|
||||
BUY_USER_ID varchar(16) NOT NULL,
|
||||
BUY_ACCOUNT varchar(20) NOT NULL,
|
||||
SELL_USER_ID varchar(16) NOT NULL,
|
||||
SELL_ACCOUNT varchar(20) NOT NULL,
|
||||
TRADE_FROM varchar(100),
|
||||
TRADE_EMAIL varchar(100),
|
||||
IS_INPOUR_REFUND VARCHAR(1),
|
||||
REFUND_FLOW_TYPE VARCHAR(1),
|
||||
GMT_LAST_APPLY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
REFUND_FOREX_FEE int,
|
||||
PRIMARY KEY (TRADE_NO, ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
CREATE INDEX TRADE_REFUND_BG_IND ON TRADE_REFUND_000
|
||||
(BUY_ACCOUNT, GMT_CREATE);
|
||||
|
||||
CREATE INDEX TRADE_REFUND_SG_IND ON TRADE_REFUND_000
|
||||
(SELL_ACCOUNT, GMT_CREATE);
|
||||
|
||||
CREATE INDEX TRADE_REFUND_TG_IND ON TRADE_REFUND_000
|
||||
(TRADE_EMAIL, GMT_CREATE);
|
||||
|
||||
CREATE INDEX TRADE_REFUND_000_GMT_IND ON TRADE_REFUND_000 (GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_VOUCHER_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
TRADE_NO varchar(64) default ' ' NOT NULL,
|
||||
REFUND_ID int NOT NULL,
|
||||
SELLER_OR_BUYER VARCHAR(1) default 'S' NOT NULL,
|
||||
SELLER_UPLOAD_VOUCHER varchar(4000),
|
||||
BUYER_UPLOAD_VOUCHER varchar(4000),
|
||||
UPLOAD_FLAG int default 0 NOT NULL,
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_CHECK TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
LAST_OPERATOR varchar(32),
|
||||
CHECK_MEMO varchar(2000),
|
||||
MEMEO varchar(4000),
|
||||
GMT_TIMEOUT_START TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (TRADE_NO, ID)
|
||||
) DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX TRADE_VOUCHER_000_MT_IND ON TRADE_VOUCHER_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_RECEIVE_ADDRESS_000
|
||||
(
|
||||
TRADE_NO VARCHAR(64) NOT NULL,
|
||||
ADDRESS_NO VARCHAR(100) NOT NULL,
|
||||
RECEIVE_NAME VARCHAR(256),
|
||||
ADDRESS_CODE VARCHAR(8),
|
||||
ADDRESS VARCHAR(256),
|
||||
MOBILE_PHONE VARCHAR(30),
|
||||
PHONE VARCHAR(30),
|
||||
RECEIVE_POST VARCHAR(20),
|
||||
VIRTUAL_REC_INFO VARCHAR(400),
|
||||
GMT_CREATE DATETIME NOT NULL,
|
||||
GMT_MODIFIED DATETIME,
|
||||
PRIMARY KEY (TRADE_NO, ADDRESS_NO)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
|
||||
CREATE TABLE if not exists TRADE_COOPERATE_000
|
||||
(
|
||||
TRADE_NO VARCHAR(64),
|
||||
COOPERATE_NO VARCHAR(64),
|
||||
COOPERATOR_FROM VARCHAR(32),
|
||||
GMT_CREATE TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY key (TRADE_NO, COOPERATE_NO, COOPERATOR_FROM)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX TRADE_COOPERATE_000_MT_IND ON TRADE_COOPERATE_000
|
||||
(GMT_MODIFIED);
|
||||
|
||||
CREATE TABLE if not exists TRADE_SETTLE_ORDER_000
|
||||
(
|
||||
ORDER_NO VARCHAR(64) NOT NULL,
|
||||
ORG_ORDER_NO VARCHAR(64),
|
||||
TRADE_NO VARCHAR(64) NOT NULL,
|
||||
OUT_REQUEST_NO VARCHAR(64),
|
||||
BIZ_PRODUCT VARCHAR(32),
|
||||
SETTLE_ACTION_TYPE VARCHAR(32),
|
||||
AMOUNT int NOT NULL,
|
||||
STATUS VARCHAR(50) NOT NULL,
|
||||
EXTINFO VARCHAR(1024),
|
||||
MEMO VARCHAR(512),
|
||||
SETTLE_ID VARCHAR(64),
|
||||
SETTLE_CONTEXT VARCHAR(1024),
|
||||
GMT_CREATE TIMESTAMP(6) NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP(6),
|
||||
SETTLE_TYPE VARCHAR(32),
|
||||
PRIMARY KEY (TRADE_NO, ORDER_NO, GMT_CREATE)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
|
||||
CREATE TABLE if not exists TRADE_PARTICIPANT_000
|
||||
(
|
||||
TRADE_NO VARCHAR(64) NOT NULL,
|
||||
USER_ID VARCHAR(16) NOT NULL,
|
||||
USER_NAME VARCHAR(256),
|
||||
USER_NICK VARCHAR(100),
|
||||
PARTICIPANT_ROLE VARCHAR(64) NOT NULL,
|
||||
MEMO VARCHAR(200),
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY (TRADE_NO, USER_ID, PARTICIPANT_ROLE)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists BUSINESS_ACTIVITY_ASYNC_000
|
||||
(
|
||||
TX_ID VARCHAR(128) NOT NULL,
|
||||
STATE VARCHAR(1) NOT NULL,
|
||||
ACCOUNT_TRANS_STATE VARCHAR(1) NOT NULL,
|
||||
GMT_CREATE TIMESTAMP NOT NULL,
|
||||
GMT_MODIFIED TIMESTAMP NOT NULL,
|
||||
PROPAGATION VARCHAR(1),
|
||||
CONTEXT VARCHAR(2048),
|
||||
PRIMARY KEY (TX_ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE TABLE if not exists EXTERFACE_INVOKE_000
|
||||
(
|
||||
ID int NOT NULL,
|
||||
PARTNER_ID VARCHAR(32) NOT NULL,
|
||||
TARGET VARCHAR(64) NOT NULL,
|
||||
EXTERFACE VARCHAR(128) NOT NULL,
|
||||
NOTIFY_URL VARCHAR(200),
|
||||
RETURN_URL VARCHAR(200),
|
||||
SIGN_TYPE VARCHAR(10),
|
||||
CHARSET VARCHAR(20),
|
||||
GMT_INVOKE TIMESTAMP NOT NULL,
|
||||
GMT_FINISH TIMESTAMP NOT NULL,
|
||||
TARGET_TYPE VARCHAR(20) NOT NULL,
|
||||
GMT_NOTIFY TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
GMT_RETURN TIMESTAMP(6) default "2012-01-01 12:00:00",
|
||||
PRIMARY KEY(TARGET_TYPE, TARGET, PARTNER_ID)
|
||||
)DEFAULT CHARSET = 'utf8';
|
||||
|
||||
CREATE INDEX EXTERFACE_INVOKE_000_ID_IND ON EXTERFACE_INVOKE_000(ID);
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE if exists trade_sequence_000;
|
||||
DROP TABLE if exists BUSINESS_ACTION_000;
|
||||
DROP TABLE if exists BUSINESS_ACTIVITY_000;
|
||||
DROP TABLE if exists NOTIFY_000 ;
|
||||
DROP TABLE if exists NOTIFY_HISTORY_000 ;
|
||||
DROP TABLE if exists TIMEOUT_000 ;
|
||||
DROP TABLE if exists TIMEOUT_HISTORY_000 ;
|
||||
DROP TABLE if exists TIMEOUT_LONG_000 ;
|
||||
DROP TABLE if exists TIMEOUT_REMIND_000;
|
||||
DROP TABLE if exists TRADE_BASE_000 ;
|
||||
DROP TABLE if exists TRADE_CHARGE_000;
|
||||
DROP TABLE if exists TRADE_EXT_000 ;
|
||||
DROP TABLE if exists TRADE_FUND_BILL_000 ;
|
||||
DROP TABLE if exists TRADE_GOODS_INFO_000 ;
|
||||
DROP TABLE if exists TRADE_LOGISTICS_000;
|
||||
DROP TABLE if exists TRADE_MESSAGE_BOARD_000 ;
|
||||
DROP TABLE if exists TRADE_NOTE_000 ;
|
||||
DROP TABLE if exists TRADE_OUTTRADE_000 ;
|
||||
DROP TABLE if exists TRADE_PAYMENT_CLAUSE_000 ;
|
||||
DROP TABLE if exists TRADE_PAYMENT_ORDER_000 ;
|
||||
DROP TABLE if exists TRADE_PROCESS_000 ;
|
||||
DROP TABLE if exists TRADE_REFUND_000 ;
|
||||
DROP TABLE if exists TRADE_VOUCHER_000 ;
|
||||
DROP TABLE if exists TRADE_RECEIVE_ADDRESS_000;
|
||||
DROP TABLE if exists TRADE_COOPERATE_000;
|
||||
DROP TABLE if exists TRADE_SETTLE_ORDER_000;
|
||||
DROP TABLE if exists TRADE_PARTICIPANT_000;
|
||||
DROP TABLE if exists BUSINESS_ACTIVITY_ASYNC_000;
|
||||
DROP TABLE if exists EXTERFACE_INVOKE_000;
|
||||
--enable_warnings
|
||||
1747
tools/deploy/mysql_test/t/add.test
Normal file
1747
tools/deploy/mysql_test/t/add.test
Normal file
File diff suppressed because it is too large
Load Diff
18
tools/deploy/mysql_test/t/aggr_bug200109.test
Normal file
18
tools/deploy/mysql_test/t/aggr_bug200109.test
Normal file
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: sql4
|
||||
# description: group by count测试
|
||||
# bug http://bugfree.corp.taobao.com/bug/200109
|
||||
# multiple count(distinct)
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (id int primary key, n1 int, n2 int, s varchar(20), vs varchar(20), t varchar(256));
|
||||
insert into t1 values (0, NULL, NULL, 'zero', 'zero', 'zero'), (1,1,11, 'one','eleven', 'eleven'), (2,1,11, 'one','eleven', 'eleven'), (3,2,11, 'two','eleven', 'eleven'), (4,2,12, 'two','twevle', 'twelve'), (5,2,13, 'two','thirteen', 'foo'), (6,2,13, 'two','thirteen', 'foo'), (7,2,13, 'two','thirteen', 'bar'), (8,NULL,13, 'two','thirteen', 'bar'), (9,2,NULL, 'two','thirteen', 'bar'), (10,2,13, NULL,'thirteen', 'bar'), (11,2,13, 'two',NULL, 'bar'), (12,2,13, 'two','thirteen', NULL);
|
||||
select n1, n2 from t1;
|
||||
select count(distinct n1), count(distinct n2) from t1;
|
||||
select count(n1), count(distinct n1), count(n2), count(distinct n2) from t1;
|
||||
select count(distinct n1), count(distinct n2), count(n1), count(n2) from t1;
|
||||
#drop table t1;
|
||||
35
tools/deploy/mysql_test/t/alias2.test
Normal file
35
tools/deploy/mysql_test/t/alias2.test
Normal file
@ -0,0 +1,35 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
#owner group:sql2
|
||||
#description:this case is use for test online use of ob1.0
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
select 1+2 c1;
|
||||
select 1+2 as c1;
|
||||
select 1 c1;
|
||||
select 1 as c1;
|
||||
|
||||
select 1+2 c1 from dual where 1=1;
|
||||
select 1+2 as c1 from dual where 1=1;
|
||||
select 1 c1 from dual where 1=1;
|
||||
select 1 as c1 from dual where NULL is NULL;
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
|
||||
insert into t1 values(1,1),(2,1);
|
||||
select c2 +100 c3 from t1 where c1=1;
|
||||
select c2 -100 c3 from t1 where c1 in (1,2);
|
||||
drop table t1;
|
||||
|
||||
create table t1(c1 int,c2 varchar(1024),c3 float,c4 datetime(6),c5 int,c6 varchar(1024),c7 float, primary key(c1,c2));
|
||||
insert into t1 (c1,c2,c3,c5,c6,c7) values(1,'s',1.5,1,'t',2.5);
|
||||
select c5+1 c51,c6 c61,c7+1 c71 from t1 where c1=1 and c2='s' and c3=1.5;
|
||||
select c5+1 c51,c6 c61,c7+1 c71 from t1 where c1=1 and c2='s' and c3=1.5 and c5 in (1,2,3);
|
||||
|
||||
drop table t1;
|
||||
44
tools/deploy/mysql_test/t/alias3.test
Normal file
44
tools/deploy/mysql_test/t/alias3.test
Normal file
@ -0,0 +1,44 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
#owner group:sql2
|
||||
# tags: dml
|
||||
#description:this case is use for test online use of ob1.0
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
|
||||
insert into t1 values(7,3),(8,3),(1,1),(2,0),(3,1),(4,0),(5,2),(6,2);
|
||||
|
||||
# group by test
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 order by a1;
|
||||
select c1 as a1,c2 as a2 from t1 group by a1 order by a2;
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 order by a2;
|
||||
select c1 as a1,c2 as a2 from t1 group by a1 order by a1;
|
||||
|
||||
# order by test
|
||||
select c1 as a1,c2 as a2 from t1 order by a2;
|
||||
select c1 as a1,c2 as a2 from t1 order by a1;
|
||||
|
||||
# having test
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 having a2>0 order by a1;
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 having a2>0 order by a2;
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 having a1>0 order by a1;
|
||||
select c1 as a1,c2 as a2 from t1 group by a2 having a1>0 order by a2;
|
||||
|
||||
|
||||
# select expr
|
||||
select c1+c2 as total from t1 order by total;
|
||||
select c1, c1+c2 as total from t1 group by total order by c1;
|
||||
select c1, c1+c2 as total from t1 group by total having c1>2 order by c1 desc;
|
||||
|
||||
|
||||
# refer to column alias in where
|
||||
select c1 as a1, c2 as a2 from t1 where c1>1;
|
||||
select c1 as a1, c2 as a2 from t1 where c2>1;
|
||||
select c1,c1+c2 as a1 from t1 where c1+c2>2;
|
||||
36
tools/deploy/mysql_test/t/bench_count_distinct.test
Normal file
36
tools/deploy/mysql_test/t/bench_count_distinct.test
Normal file
@ -0,0 +1,36 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
#tags: optimizer, create_table, insert
|
||||
#description:
|
||||
|
||||
#
|
||||
# Test of count(distinct ..)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a1;
|
||||
--enable_warnings
|
||||
create table a1(rowkey_suffix int primary key, price int) ;
|
||||
let $1=100;
|
||||
let $2=200;
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into a1(rowkey_suffix, price) values($2, $1);
|
||||
dec $2;
|
||||
eval insert into a1(rowkey_suffix, price) values($2, $1);
|
||||
dec $1;
|
||||
dec $2;
|
||||
}
|
||||
enable_query_log;
|
||||
select count(distinct price) from a1;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
#explain extended select count(distinct n) from t1;
|
||||
--enable_result_log
|
||||
#drop table t1;
|
||||
drop table a1;
|
||||
# End of 4.1 tests
|
||||
35
tools/deploy/mysql_test/t/big_trans_with_mutil_redo.test
Normal file
35
tools/deploy/mysql_test/t/big_trans_with_mutil_redo.test
Normal file
@ -0,0 +1,35 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: shanyan.g
|
||||
# owner group: transaction
|
||||
# description: test the big transaction with multiple redo logs!
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#每条记录占用内存大小(4KB,5KB)
|
||||
create table t1(i int primary key, c1 varchar(1024), c256 varchar(1024), dt datetime(6), d datetime(6));
|
||||
#设置语句级的超时时间为100s
|
||||
set ob_query_timeout=100000000;
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
|
||||
#insert
|
||||
begin;
|
||||
#950个字符
|
||||
let $value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
|
||||
let $i=0;
|
||||
while($i < 2000)
|
||||
{
|
||||
eval insert into t1(i,c1,c256,dt,d) values($i,'$value','$value','2012-10-10 12:00:00','2012-10-10');
|
||||
inc $i;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
select count(i) from t1;
|
||||
|
||||
drop table t1;
|
||||
17
tools/deploy/mysql_test/t/bug200747.test
Normal file
17
tools/deploy/mysql_test/t/bug200747.test
Normal file
@ -0,0 +1,17 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists ob_new_sql_test;
|
||||
--enable_warnings
|
||||
|
||||
create table ob_new_sql_test(c0 varchar(20), c1 int primary key, c2 int , c3 int,c4 int,c5 int,c6 int,c7 int,c8 int,c9 int,c10 int,c11 int,c12 int,c13 int,c14 int,c15 int);
|
||||
insert into ob_new_sql_test (c0, c1) values ('hello', 0);
|
||||
|
||||
select * from ob_new_sql_test where c1 < 1;
|
||||
select * from ob_new_sql_test where c1 = 0;
|
||||
|
||||
drop table ob_new_sql_test;
|
||||
14
tools/deploy/mysql_test/t/bug210026.test
Normal file
14
tools/deploy/mysql_test/t/bug210026.test
Normal file
@ -0,0 +1,14 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: ddl
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
--error 1068
|
||||
create table t1(a int primary key, b int primary key);
|
||||
@ -0,0 +1,23 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: dachuan.sdc
|
||||
#owner group: sql1
|
||||
#tags: create_table, insert
|
||||
#description:
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
insert into t1 values(1,1),(2,2),(3,3);
|
||||
|
||||
let $cnt=30;
|
||||
while($cnt)
|
||||
{
|
||||
select * from t1 as t2 where c1=1;
|
||||
dec $cnt;
|
||||
}
|
||||
|
||||
drop table t1;
|
||||
@ -0,0 +1,33 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
## update
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a bigint primary key , b bigint);
|
||||
insert into t1 values(1,1),(2,2);
|
||||
|
||||
update t1 set b=100 WHERE ( a = 1 ) OR (( b = 3 ) AND ( a = 2 )) order by a desc limit 1;
|
||||
select * from t1;
|
||||
update t1 set b=200 WHERE ( a = 1 ) OR (( b = 3 ) AND ( a = 2 )) order by a desc;
|
||||
select * from t1;
|
||||
update t1 set b=300 WHERE ( a = 1 ) OR (( b = 3 ) AND ( a = 2 )) order by a limit 1;
|
||||
select * from t1;
|
||||
|
||||
## delete
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a bigint primary key , b bigint);
|
||||
insert into t1 values(1,1),(2,2);
|
||||
|
||||
delete from t1 WHERE ( a = 1 ) OR (( b = 3 ) AND ( a = 2 )) order by a desc limit 1;
|
||||
select * from t1;
|
||||
delete from t1 WHERE ( a = 1 ) OR (( b = 3 ) AND ( a = 2 )) order by a desc;
|
||||
select * from t1;
|
||||
26
tools/deploy/mysql_test/t/bug_setEmptyPwd.test
Normal file
26
tools/deploy/mysql_test/t/bug_setEmptyPwd.test
Normal file
@ -0,0 +1,26 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--error 1064
|
||||
set password for = password('pass11');
|
||||
--error 1064
|
||||
set password '' for = password('pass11');
|
||||
|
||||
--real_sleep 5
|
||||
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--error 1133
|
||||
set password for '' = password('pass11');
|
||||
--error 1396
|
||||
create user '' identified by 'pass11';
|
||||
--real_sleep 5
|
||||
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
212
tools/deploy/mysql_test/t/bulk_insert.test
Normal file
212
tools/deploy/mysql_test/t/bulk_insert.test
Normal file
@ -0,0 +1,212 @@
|
||||
#owner: chaser.ch
|
||||
#group: storage2
|
||||
|
||||
#### bulk insert with space
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
|
||||
create table t (a char(10) not null);
|
||||
insert into t values('b'),('b ');
|
||||
select hex(a) from t;
|
||||
insert into t values('b '),('b');
|
||||
select hex(a) from t;
|
||||
drop table t;
|
||||
|
||||
#
|
||||
# prepare basic data for big table
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists test_bulk, test_bulk_prefix;
|
||||
--enable_warnings
|
||||
create table test_bulk(a int, b int, c int, d int, primary key(a, b)) row_format = redundant;
|
||||
create table test_bulk_prefix(a int, b int, c int, d int, primary key(a, b, c, d)) row_format = redundant;
|
||||
|
||||
--let $insert_sql_prefix=insert into test_bulk values
|
||||
--let $value=(0,0,0,0)
|
||||
--let $loop=600
|
||||
while($loop > 0)
|
||||
{
|
||||
--let $value=$value,($loop,11,1,1)
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
--let $insert_sql_prefix=$insert_sql_prefix$value
|
||||
|
||||
|
||||
--let $loop=100
|
||||
while($loop > 0)
|
||||
{
|
||||
eval insert into test_bulk values ($loop,1,1,1), ($loop,2,1,1), ($loop,3,1,1), ($loop,4,1,1), ($loop,5,1,1), ($loop,6,1,1), ($loop,7,1,1), ($loop,8,1,1), ($loop,9,1,1), ($loop,10,1,1);
|
||||
eval insert into test_bulk_prefix values ($loop,1,1,1), ($loop,2,2,2), ($loop,3,3,3), ($loop,4,4,4), ($loop,5,5,5), ($loop,6,6,6), ($loop,7,7,7), ($loop,8,8,8), ($loop,9,9,9), ($loop,10,10,10);
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
--let $loop=9
|
||||
# memtable values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1),($loop,$loop,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop,1,1);
|
||||
# prefix exist with memtable duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk_prefix values ($loop, $loop, $loop, 1),($loop, $loop, $loop, 2),($loop, $loop, $loop, 3),($loop, $loop, $loop, 4),($loop, $loop, $loop, 5),($loop, $loop, $loop, 6),($loop, $loop, $loop, 7),($loop, $loop, $loop, 8),($loop, $loop, $loop, 9),($loop, $loop, $loop, 10);
|
||||
|
||||
# major freeze for baseline data
|
||||
alter system major freeze;
|
||||
--source mysql_test/include/wait_daily_merge.inc
|
||||
|
||||
# bulk insert with error
|
||||
--let $loop=5
|
||||
while($loop > 0)
|
||||
{
|
||||
# values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1);
|
||||
# major values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1),($loop,$loop,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop,1,1);
|
||||
# prefix exist with duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk_prefix values ($loop, $loop, $loop, 1),($loop, $loop, $loop, 2),($loop, $loop, $loop, 3),($loop, $loop, $loop, 4),($loop, $loop, $loop, 5),($loop, $loop, $loop, 6),($loop, $loop, $loop, 7),($loop, $loop, $loop, 8),($loop, $loop, $loop, 9),($loop, $loop, $loop, 10);
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
--let $insert_sql=$insert_sql_prefix,(50,1,1,1)
|
||||
--disable_query_log
|
||||
--error 1062
|
||||
eval $insert_sql;
|
||||
--enable_query_log
|
||||
|
||||
# prepare data for minor merge
|
||||
--let $loop=150
|
||||
while($loop > 130)
|
||||
{
|
||||
eval insert into test_bulk values ($loop,1,1,1), ($loop,2,1,1), ($loop,3,1,1), ($loop,4,1,1), ($loop,5,1,1), ($loop,6,1,1), ($loop,7,1,1), ($loop,8,1,1), ($loop,9,1,1), ($loop,10,1,1);
|
||||
# prefix not exist
|
||||
eval insert into test_bulk_prefix values ($loop, $loop, $loop, 1),($loop, $loop, $loop, 2),($loop, $loop, $loop, 3),($loop, $loop, $loop, 4),($loop, $loop, $loop, 5),($loop, $loop, $loop, 6),($loop, $loop, $loop, 7),($loop, $loop, $loop, 8),($loop, $loop, $loop, 9),($loop, $loop, $loop, 10);
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
set ob_query_timeout=100000000;
|
||||
alter system minor freeze;
|
||||
--source mysql_test/include/wait_minor_merge.inc
|
||||
|
||||
# bulk insert with error
|
||||
--let $loop=140
|
||||
--let $loop2=10
|
||||
while($loop > 135)
|
||||
{
|
||||
# values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1);
|
||||
# minor values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop2,1,1);
|
||||
# major values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop2,11,1,1), ($loop2,12,1,1), ($loop2,13,1,1), ($loop2,14,1,1), ($loop2,15,1,1), ($loop2,$loop2,1,1), ($loop2,17,1,1), ($loop2,18,1,1), ($loop2,19,1,1), ($loop2,20,1,1);
|
||||
# prefix exist with duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk_prefix values ($loop, $loop, $loop, 1),($loop, $loop, $loop, 2),($loop, $loop, $loop, 3),($loop, $loop, $loop, 4),($loop, $loop, $loop, 5),($loop, $loop, $loop, 6),($loop, $loop, $loop, 7),($loop, $loop, $loop, 8),($loop, $loop, $loop, 9),($loop, $loop, $loop, 10);
|
||||
dec $loop;
|
||||
dec $loop2;
|
||||
}
|
||||
|
||||
--let $insert_sql=$insert_sql_prefix,(140,1,1,1)
|
||||
--disable_query_log
|
||||
--error 1062
|
||||
eval $insert_sql;
|
||||
--enable_query_log
|
||||
|
||||
# prepare data for minor merge
|
||||
--let $loop=200
|
||||
while($loop > 180)
|
||||
{
|
||||
eval insert into test_bulk values ($loop,1,1,1), ($loop,2,1,1), ($loop,3,1,1), ($loop,4,1,1), ($loop,5,1,1), ($loop,6,1,1), ($loop,7,1,1), ($loop,8,1,1), ($loop,9,1,1), ($loop,10,1,1);
|
||||
# prefix exist without duplicate
|
||||
eval insert into test_bulk_prefix values ($loop, $loop, $loop, 1),($loop, $loop, $loop, 2),($loop, $loop, $loop, 3),($loop, $loop, $loop, 4),($loop, $loop, $loop, 5),($loop, $loop, $loop, 6),($loop, $loop, $loop, 7),($loop, $loop, $loop, 8),($loop, $loop, $loop, 9),($loop, $loop, $loop, 10);
|
||||
dec $loop;
|
||||
}
|
||||
|
||||
# bulk insert with error
|
||||
--let $loop=190
|
||||
--let $loop2=140
|
||||
--let $loop3=50
|
||||
--let $loop4=10
|
||||
while($loop > 185)
|
||||
{
|
||||
# values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1);
|
||||
# memtable values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop4,1,1);
|
||||
# minor values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop2,11,1,1), ($loop2,12,1,1), ($loop2,13,1,1), ($loop2,$loop4,1,1), ($loop2,15,1,1), ($loop2,16,1,1), ($loop2,17,1,1), ($loop2,18,1,1), ($loop2,19,1,1), ($loop2,20,1,1);
|
||||
# major values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop3,11,1,1), ($loop3,12,1,1), ($loop3,13,1,1), ($loop3,14,1,1), ($loop3,15,1,1), ($loop3,$loop3,1,1), ($loop3,17,1,1), ($loop3,$loop4,1,1), ($loop3,19,1,1), ($loop3,20,1,1);
|
||||
dec $loop;
|
||||
dec $loop2;
|
||||
dec $loop3;
|
||||
dec $loop4;
|
||||
}
|
||||
|
||||
--let $insert_sql=$insert_sql_prefix,(190,1,1,1)
|
||||
--disable_query_log
|
||||
--error 1062
|
||||
eval $insert_sql;
|
||||
--enable_query_log
|
||||
|
||||
# delete some data
|
||||
delete from test_bulk where a = 170;
|
||||
delete from test_bulk where a = 90;
|
||||
|
||||
# bulk insert with error
|
||||
--let $loop=185
|
||||
--let $loop2=140
|
||||
--let $loop3=50
|
||||
--let $loop4=10
|
||||
while($loop > 180)
|
||||
{
|
||||
# values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1), ($loop,$loop,1,1);
|
||||
# memtable values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values (90,1,1,1), (90,2,1,1), (90,3,1,1), (90,4,1,1), (90,5,1,1), (90,6,1,1), (90,7,1,1), (90,8,1,1), (90,9,1,1), (90,10,1,1), ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop4,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values (170,1,1,1), (170,2,1,1), (170,3,1,1), (170,4,1,1), (170,5,1,1), (170,6,1,1), (170,7,1,1), (170,8,1,1), (170,9,1,1), (170,10,1,1), ($loop,11,1,1), ($loop,12,1,1), ($loop,13,1,1), ($loop,14,1,1), ($loop,15,1,1), ($loop,16,1,1), ($loop,17,1,1), ($loop,18,1,1), ($loop,19,1,1), ($loop,$loop4,1,1);
|
||||
# minor values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values (90,1,1,1), (90,2,1,1), (90,3,1,1), (90,4,1,1), (90,5,1,1), (90,6,1,1), (90,7,1,1), (90,8,1,1), (90,9,1,1), (90,10,1,1), ($loop2,11,1,1), ($loop2,12,1,1), ($loop2,13,1,1), ($loop2,$loop4,1,1), ($loop2,15,1,1), ($loop2,16,1,1), ($loop2,17,1,1), ($loop2,18,1,1), ($loop2,19,1,1), ($loop2,20,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values (170,1,1,1), (170,2,1,1), (170,3,1,1), (170,4,1,1), (170,5,1,1), (170,6,1,1), (170,7,1,1), (170,8,1,1), (170,9,1,1), (170,10,1,1), ($loop2,11,1,1), ($loop2,12,1,1), ($loop2,13,1,1), ($loop2,$loop4,1,1), ($loop2,15,1,1), ($loop2,16,1,1), ($loop2,17,1,1), ($loop2,18,1,1), ($loop2,19,1,1), ($loop2,20,1,1);
|
||||
# major values duplicate
|
||||
--error 1062
|
||||
eval insert into test_bulk values (90,1,1,1), (90,2,1,1), (90,3,1,1), (90,4,1,1), (90,5,1,1), (90,6,1,1), (90,7,1,1), (90,8,1,1), (90,9,1,1), (90,10,1,1), ($loop3,11,1,1), ($loop3,12,1,1), ($loop3,13,1,1), ($loop3,14,1,1), ($loop3,15,1,1), ($loop3,$loop3,1,1), ($loop3,17,1,1), ($loop3,$loop4,1,1), ($loop3,19,1,1), ($loop3,20,1,1);
|
||||
--error 1062
|
||||
eval insert into test_bulk values (170,1,1,1), (170,2,1,1), (170,3,1,1), (170,4,1,1), (170,5,1,1), (170,6,1,1), (170,7,1,1), (170,8,1,1), (170,9,1,1), (170,10,1,1), ($loop3,11,1,1), ($loop3,12,1,1), ($loop3,13,1,1), ($loop3,14,1,1), ($loop3,15,1,1), ($loop3,$loop3,1,1), ($loop3,17,1,1), ($loop3,$loop4,1,1), ($loop3,19,1,1), ($loop3,20,1,1);
|
||||
dec $loop;
|
||||
dec $loop2;
|
||||
dec $loop3;
|
||||
dec $loop4;
|
||||
}
|
||||
|
||||
--let $insert_sql=$insert_sql_prefix,(90,1,1,1),(90,2,1,1),(90,3,1,1),(90,4,1,1),(90,5,1,1),(170,6,1,1),(170,7,1,1),(170,8,1,1),(170,9,1,1),(170,10,1,1),(150,1,1,1)
|
||||
--disable_query_log
|
||||
--error 1062
|
||||
eval $insert_sql;
|
||||
--enable_query_log
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
21
tools/deploy/mysql_test/t/chinese.test
Normal file
21
tools/deploy/mysql_test/t/chinese.test
Normal file
@ -0,0 +1,21 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: jim.wjh
|
||||
# owner group: SQL3
|
||||
# description: foobar
|
||||
--echo case 1: commit
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection conn1;
|
||||
show variables like 'autocommit';
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int primary key, c2 varchar(1024));
|
||||
set autocommit=0;
|
||||
insert into t1 values (1, '中国');
|
||||
select * from t1 where c1 = 1 for update;
|
||||
commit;
|
||||
set autocommit=1;
|
||||
select * from t1;
|
||||
disconnect conn1;
|
||||
39
tools/deploy/mysql_test/t/column_alias.test
Normal file
39
tools/deploy/mysql_test/t/column_alias.test
Normal file
@ -0,0 +1,39 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: dml
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists tt1;
|
||||
--enable_warnings
|
||||
|
||||
create table tt1(c1 int primary key, c2 int);
|
||||
insert into tt1 values(1,4);
|
||||
insert into tt1 values(2,3);
|
||||
|
||||
select c1, c2 as c1 from tt1;
|
||||
|
||||
--error 1052
|
||||
select c1, c2 as c1 from tt1 order by c1;
|
||||
|
||||
select c2 as c1 from tt1 order by c1;
|
||||
|
||||
select c2 as c1 from tt1 where c1<4;
|
||||
|
||||
select c1 as cc, c2 as c1 from tt1 where c1<4;
|
||||
|
||||
select c1 as cc, c2 as c1 from tt1 order by c1;
|
||||
|
||||
select c1, c2 as c1 from tt1 where c1<4;
|
||||
|
||||
select c2 as cc from tt1 order by c1;
|
||||
|
||||
select c2 as c1 from tt1 order by c1;
|
||||
|
||||
select c1 as c1, c2 as c1 from tt1 where c1<4;
|
||||
#show columns from t1 like 'c1';
|
||||
show columns from tt1;
|
||||
#show columns from t1 like '%c%';
|
||||
121
tools/deploy/mysql_test/t/compare.test
Normal file
121
tools/deploy/mysql_test/t/compare.test
Normal file
@ -0,0 +1,121 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
#tags: optimizer, datatype, dml
|
||||
#description:
|
||||
|
||||
--disable_abort_on_error
|
||||
##
|
||||
## Bug when using comparions of strings and integers.
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists ob_new_sql_test;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists a1;
|
||||
--enable_warnings
|
||||
#
|
||||
#CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
|
||||
#--real_sleep 1
|
||||
create table ob_new_sql_test(c0 varchar(10) primary key, c1 int, c2 int);
|
||||
#--real_sleep 1
|
||||
insert into ob_new_sql_test(c0, c1) values ('0001',1);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
#explain select * from t1 where id=000000000001;
|
||||
--enable_result_log
|
||||
select * from ob_new_sql_test where c0='0001';
|
||||
#delete from t1 where id=000000000002;
|
||||
select * from ob_new_sql_test;
|
||||
#--error 4002013
|
||||
select length(c0) from ob_new_sql_test;
|
||||
|
||||
#not support functions
|
||||
#--error 1128
|
||||
select hex(c0) from ob_new_sql_test;
|
||||
|
||||
drop table ob_new_sql_test;
|
||||
#
|
||||
##
|
||||
## Check the following:
|
||||
## 'a' == 'a '
|
||||
## 'a\0' < 'a'
|
||||
## 'a\0' < 'a '
|
||||
#
|
||||
SELECT 'a' = 'a ';
|
||||
SELECT 'a\0' < 'a';
|
||||
SELECT 'a\0' < 'a ';
|
||||
SELECT 'a\t' < 'a';
|
||||
SELECT 'a\t' < 'a ';
|
||||
#
|
||||
#CREATE TABLE t1 (a char(10) not null);
|
||||
#INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
|
||||
#SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
## Bug #8134: Comparison against CHAR(31) at end of string
|
||||
#SELECT CHAR(31) = '', '' = CHAR(31);
|
||||
## Extra test
|
||||
#SELECT CHAR(30) = '', '' = CHAR(30);
|
||||
#
|
||||
## End of 4.1 tests
|
||||
#
|
||||
##
|
||||
##Bug #21159: Optimizer: wrong result after AND with different data types
|
||||
##
|
||||
#--real_sleep 1
|
||||
create table a1 (rowkey_suffix int primary key,price int);
|
||||
#--real_sleep 1
|
||||
insert into a1 (rowkey_suffix, price) values(10,10);
|
||||
insert into a1 (rowkey_suffix, price) values(20,20);
|
||||
select * from a1 where rowkey_suffix=price;
|
||||
select * from a1 where rowkey_suffix=price and price=10;
|
||||
drop table a1;
|
||||
#drop table if exists t1;
|
||||
#
|
||||
##
|
||||
## Bug #31887: DML Select statement not returning same results when executed
|
||||
## in version 5
|
||||
##
|
||||
#
|
||||
#CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
|
||||
#INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
|
||||
#
|
||||
#SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
|
||||
#
|
||||
--disable_result_log
|
||||
#EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
--enable_result_log
|
||||
#SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
#
|
||||
#CREATE TABLE t2 (a int);
|
||||
#INSERT INTO t2 VALUES (1),(2);
|
||||
#
|
||||
#SELECT a,
|
||||
# (SELECT COUNT(*) FROM t1
|
||||
# WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
#FROM t2 ORDER BY a;
|
||||
#
|
||||
--disable_result_log
|
||||
#EXPLAIN EXTENDED
|
||||
--enable_result_log
|
||||
#SELECT a,
|
||||
# (SELECT COUNT(*) FROM t1
|
||||
# WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
#FROM t2 ORDER BY a;
|
||||
#
|
||||
#DROP TABLE t1,t2;
|
||||
#
|
||||
##
|
||||
## Bug #39353: Multiple conditions on timestamp column crashes server
|
||||
##
|
||||
#
|
||||
#CREATE TABLE t1 (a TIMESTAMP);
|
||||
#INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
#SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
#--echo End of 5.0 tests
|
||||
41
tools/deploy/mysql_test/t/connection.test
Normal file
41
tools/deploy/mysql_test/t/connection.test
Normal file
@ -0,0 +1,41 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
--disable_query_log
|
||||
--error 1049
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,database_not_exist,$OBMYSQL_PORT);
|
||||
--enable_query_log
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
connection conn1;
|
||||
create table t1(a int primary key,b int);
|
||||
let $a=1;
|
||||
--disable_query_log
|
||||
while($a<1000)
|
||||
{
|
||||
|
||||
eval insert into t1(a) values($a);
|
||||
inc $a;
|
||||
}
|
||||
--enable_query_log
|
||||
disconnect conn1;
|
||||
|
||||
connection conn2;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
disconnect conn2;
|
||||
|
||||
connection conn3;
|
||||
create table t1(a int primary key,b int);
|
||||
drop table t1;
|
||||
disconnect conn3;
|
||||
27
tools/deploy/mysql_test/t/count.test
Normal file
27
tools/deploy/mysql_test/t/count.test
Normal file
@ -0,0 +1,27 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
#tags: group_by
|
||||
#description: 本case用于测试count聚合函数
|
||||
##
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
select count(*);
|
||||
select count(*) from dual;
|
||||
|
||||
create table t1 (libname varchar(21), city varchar(256), primary key (libname));
|
||||
select count(*) from t1;
|
||||
|
||||
insert into t1 values ('test1','city1'),('test2','city2');
|
||||
insert into t1 values ('l', null);
|
||||
replace into t1 values ('2', null);
|
||||
replace into t1 values ('test3','city3'),('test4','city4');
|
||||
select count(*) from t1;
|
||||
select count(city) from t1;
|
||||
|
||||
--error 1149
|
||||
select count(t1.*) from t1;
|
||||
31
tools/deploy/mysql_test/t/create_using_type.test
Normal file
31
tools/deploy/mysql_test/t/create_using_type.test
Normal file
@ -0,0 +1,31 @@
|
||||
# owner: dachuan.sdc
|
||||
# owner group: sql2
|
||||
# description
|
||||
# tags: ddl
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists hualong;
|
||||
create database hualong;
|
||||
use hualong;
|
||||
--enable_warnings
|
||||
|
||||
create table using_hash_t1 (c1 int, c2 int, primary key using hash (c1));
|
||||
create table using_btree_t1 (c1 int, c2 int, primary key using btree (c1));
|
||||
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
select t.table_name, t.index_using_type from oceanbase.__all_virtual_table t join oceanbase.__all_virtual_database d on t.database_id = d.database_id where t.table_name = 'using_hash_t1' and d.database_name = 'hualong';
|
||||
select t.table_name, t.index_using_type from oceanbase.__all_virtual_table t join oceanbase.__all_virtual_database d on t.database_id = d.database_id where t.table_name = 'using_btree_t1' and d.database_name = 'hualong';
|
||||
|
||||
#show index with hash index
|
||||
select index_table.table_name as index_name, data_table.table_name as data_table_name, index_table.index_using_type
|
||||
from oceanbase.__all_virtual_table index_table join oceanbase.__all_virtual_table data_table
|
||||
on index_table.data_table_id = data_table.table_id
|
||||
where index_table.index_using_type = 1 and index_table.tenant_id = 1 and index_table.tenant_id = data_table.tenant_id
|
||||
order by 1;
|
||||
connection default;
|
||||
drop database hualong;
|
||||
736
tools/deploy/mysql_test/t/createsql.test
Normal file
736
tools/deploy/mysql_test/t/createsql.test
Normal file
@ -0,0 +1,736 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : jim.wjh
|
||||
#owner group: sql2
|
||||
#description: todo
|
||||
--disable_warnings
|
||||
drop database if exists createsql;
|
||||
--enable_warnings
|
||||
create database createsql;
|
||||
use createsql;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_shishi_000(
|
||||
thedate datetime(6),
|
||||
puttype int,
|
||||
sourcetype int,
|
||||
clickprice int,
|
||||
click int,
|
||||
custid int,
|
||||
impression int,
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_feed_bidword_ob_000(
|
||||
bidwordid int,
|
||||
searchtype int,
|
||||
thedate datetime(6),
|
||||
adgroupid int,
|
||||
freeclick int,
|
||||
directtransactionshipping int,
|
||||
matchscope int,
|
||||
memberid int,
|
||||
feedid int,
|
||||
favshoptotal int,
|
||||
cost int,
|
||||
campaignid int,
|
||||
favitemtotal int,
|
||||
indirecttransaction int,
|
||||
gmt_created datetime default now(),
|
||||
gmt_modified datetime default now(),
|
||||
directtransaction int,
|
||||
indirecttransactionshipping int,
|
||||
network int,
|
||||
invalidclick int,
|
||||
bidwordstr varchar(300),
|
||||
custid int,
|
||||
impression int,
|
||||
itemid int,
|
||||
click int,
|
||||
ranksum int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,bidwordid,feedid,network,matchscope)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_lixian_000(
|
||||
thedate datetime(6),
|
||||
sourcetype int,
|
||||
custid int,
|
||||
impression int,
|
||||
puttype int,
|
||||
campaignid int,
|
||||
clickprice int,
|
||||
click int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_bidword_ob_000(
|
||||
click int,
|
||||
bidwordstr varchar(300),
|
||||
custid int,
|
||||
onefavshoptotal int,
|
||||
directtransaction int,
|
||||
invalidclick int,
|
||||
network int,
|
||||
campaignid int,
|
||||
cost int,
|
||||
favitemtotal int,
|
||||
adgroupid int,
|
||||
memberid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
fifteenfavitemtotal int,
|
||||
thedate datetime(6),
|
||||
fifteenindirecttransactionshipping int,
|
||||
isshop int,
|
||||
fifteenfavshoptotal int,
|
||||
fifteendirecttransactionshipping int,
|
||||
threeindirecttransactionshipping int,
|
||||
ranksum int,
|
||||
sevenfavitemtotal int,
|
||||
impression int,
|
||||
threefavshoptotal int,
|
||||
sevenindirecttransaction int,
|
||||
indirecttransactionshipping int,
|
||||
onedirecttransactionshipping int,
|
||||
onefavitemtotal int,
|
||||
indirecttransaction int,
|
||||
threeindirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
sevendirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
fifteenindirecttransaction int,
|
||||
favshoptotal int,
|
||||
onedirecttransaction int,
|
||||
oneindirecttransactionshipping int,
|
||||
matchscope int,
|
||||
directtransactionshipping int,
|
||||
threefavitemtotal int,
|
||||
fifteendirecttransaction int,
|
||||
threedirecttransactionshipping int,
|
||||
oneindirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
bidwordid int,
|
||||
searchtype int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,bidwordid,network,matchscope)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroupplace_name_000(
|
||||
placeid int,
|
||||
placename varchar(100),
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (placeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_shishi_accumulative_000(
|
||||
custid int,
|
||||
impression int,
|
||||
sourcetype int,
|
||||
puttype int,
|
||||
thedate datetime(6),
|
||||
clickprice int,
|
||||
click int,
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_querysession_ob_000(
|
||||
relword varchar(3000),
|
||||
originalword varchar(300),
|
||||
PRIMARY KEY (originalword)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_area_ob_000(
|
||||
onedirecttransaction int,
|
||||
favshoptotal int,
|
||||
threefavitemtotal int,
|
||||
oneindirecttransactionshipping int,
|
||||
directtransactionshipping int,
|
||||
provinceid int,
|
||||
threedirecttransactionshipping int,
|
||||
fifteendirecttransaction int,
|
||||
oneindirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
ext2 int,
|
||||
threeindirecttransactionshipping int,
|
||||
threefavshoptotal int,
|
||||
impression int,
|
||||
sevenfavitemtotal int,
|
||||
ext1 int,
|
||||
onedirecttransactionshipping int,
|
||||
indirecttransactionshipping int,
|
||||
onefavitemtotal int,
|
||||
sevenindirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
fifteenindirecttransaction int,
|
||||
sevendirecttransaction int,
|
||||
cityid int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransaction int,
|
||||
indirecttransaction int,
|
||||
favitemtotal int,
|
||||
productid int,
|
||||
campaignid int,
|
||||
cost int,
|
||||
sevenindirecttransactionshipping int,
|
||||
memberid int,
|
||||
fifteenfavshoptotal int,
|
||||
fifteenfavitemtotal int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
thedate datetime(6),
|
||||
fifteendirecttransactionshipping int,
|
||||
click int,
|
||||
traffictype int,
|
||||
custid int,
|
||||
invalidclick int,
|
||||
productline int,
|
||||
directtransaction int,
|
||||
onefavshoptotal int,
|
||||
mechanism int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,traffictype,mechanism,provinceid,cityid,productline,productid,ext1,ext2)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_area_000(
|
||||
indirecttransaction int,
|
||||
mechanism int,
|
||||
competition int,
|
||||
area int,
|
||||
indirecttransactionshipping int,
|
||||
network int,
|
||||
ext1 int,
|
||||
directtransaction int,
|
||||
bidwordstr varchar(300),
|
||||
impression int,
|
||||
click int,
|
||||
ext2 int,
|
||||
thedate datetime(6),
|
||||
directtransactionshipping int,
|
||||
bidwordhash int,
|
||||
cost int,
|
||||
favshoptotal int,
|
||||
favitemtotal int,
|
||||
PRIMARY KEY (bidwordhash,thedate,area,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_feed_name_000(
|
||||
gmt_created datetime default now(),
|
||||
gmt_modified datetime default now(),
|
||||
thedate datetime(6),
|
||||
linkurl varchar(1024),
|
||||
adgroupid int,
|
||||
custid int,
|
||||
title varchar(1024),
|
||||
memberid int,
|
||||
imgurl varchar(1024),
|
||||
feedid int,
|
||||
campaignid int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,feedid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_lixian_accumulative_000(
|
||||
clickprice int,
|
||||
click int,
|
||||
sourcetype int,
|
||||
puttype int,
|
||||
thedate datetime(6),
|
||||
impression int,
|
||||
custid int,
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_creative_name_000(
|
||||
is_shop int,
|
||||
thedate datetime(6),
|
||||
linkurl varchar(1024),
|
||||
adgroupid int,
|
||||
title varchar(1024),
|
||||
custid int,
|
||||
creativeid int,
|
||||
memberid int,
|
||||
imgurl varchar(1024),
|
||||
campaignid int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,creativeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_000(
|
||||
name varchar(100),
|
||||
demographicid int,
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_star_000(
|
||||
thedate datetime(6),
|
||||
demographicid int,
|
||||
name varchar(100),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_item_ob_000(
|
||||
indirecttransactionshipping int,
|
||||
ext1 int,
|
||||
onedirecttransactionshipping int,
|
||||
onefavitemtotal int,
|
||||
sevenindirecttransaction int,
|
||||
fifteenindirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
productlineid int,
|
||||
sevendirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransaction int,
|
||||
indirecttransaction int,
|
||||
ranksum int,
|
||||
ext2 int,
|
||||
threeindirecttransactionshipping int,
|
||||
threefavshoptotal int,
|
||||
impression int,
|
||||
sevenfavitemtotal int,
|
||||
creativeid int,
|
||||
threedirecttransactionshipping int,
|
||||
fifteendirecttransaction int,
|
||||
searchtype int,
|
||||
rptext2 int,
|
||||
threedirecttransaction int,
|
||||
oneindirecttransaction int,
|
||||
onedirecttransaction int,
|
||||
favshoptotal int,
|
||||
entityid int,
|
||||
creativepv int,
|
||||
threefavitemtotal int,
|
||||
oneindirecttransactionshipping int,
|
||||
directtransactionshipping int,
|
||||
invalidclick int,
|
||||
directtransaction int,
|
||||
onefavshoptotal int,
|
||||
rptext1 int,
|
||||
click int,
|
||||
traffictype int,
|
||||
custid int,
|
||||
entitytype int,
|
||||
fifteenfavshoptotal int,
|
||||
thedate datetime(6),
|
||||
fifteenfavitemtotal int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
fifteendirecttransactionshipping int,
|
||||
favitemtotal int,
|
||||
productid int,
|
||||
cost int,
|
||||
areaid int,
|
||||
campaignid int,
|
||||
feedid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
memberid int,
|
||||
adgroupid int,
|
||||
PRIMARY KEY (memberid,thedate,productlineid,campaignid,adgroupid,creativeid,areaid,entityid,entitytype,traffictype,searchtype,productid,ext1,ext2)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_p4p_bidword_normtoorigin_000(
|
||||
normalword varchar(300),
|
||||
originalword varchar(300),
|
||||
PRIMARY KEY (normalword)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_lixian_accumulative_000(
|
||||
click int,
|
||||
clickprice int,
|
||||
puttype int,
|
||||
campaignid int,
|
||||
impression int,
|
||||
custid int,
|
||||
thedate datetime(6),
|
||||
sourcetype int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_lixian_000(
|
||||
custid int,
|
||||
impression int,
|
||||
sourcetype int,
|
||||
puttype int,
|
||||
thedate datetime(6),
|
||||
click int,
|
||||
clickprice int,
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_shishi_000(
|
||||
thedate datetime(6),
|
||||
sourcetype int,
|
||||
custid int,
|
||||
impression int,
|
||||
campaignid int,
|
||||
puttype int,
|
||||
click int,
|
||||
clickprice int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_shishi_accumulative_000(
|
||||
clickprice int,
|
||||
click int,
|
||||
puttype int,
|
||||
campaignid int,
|
||||
impression int,
|
||||
custid int,
|
||||
sourcetype int,
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_custom_ob_000(
|
||||
oneindirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
fifteendirecttransaction int,
|
||||
threedirecttransactionshipping int,
|
||||
directtransactionshipping int,
|
||||
oneindirecttransactionshipping int,
|
||||
threefavitemtotal int,
|
||||
favshoptotal int,
|
||||
onedirecttransaction int,
|
||||
indirecttransaction int,
|
||||
threeindirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
sevendirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
fifteenindirecttransaction int,
|
||||
sevenindirecttransaction int,
|
||||
onedirecttransactionshipping int,
|
||||
indirecttransactionshipping int,
|
||||
onefavitemtotal int,
|
||||
sevenfavitemtotal int,
|
||||
impression int,
|
||||
threefavshoptotal int,
|
||||
threeindirecttransactionshipping int,
|
||||
ranksum int,
|
||||
fifteendirecttransactionshipping int,
|
||||
fifteenfavitemtotal int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
thedate datetime(6),
|
||||
fifteenfavshoptotal int,
|
||||
memberid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
cost int,
|
||||
favitemtotal int,
|
||||
onefavshoptotal int,
|
||||
directtransaction int,
|
||||
invalidclick int,
|
||||
custid int,
|
||||
click int,
|
||||
PRIMARY KEY (custid,thedate)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_purchase_000(
|
||||
demographicid int,
|
||||
thedate datetime(6),
|
||||
name varchar(100),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_tag_000(
|
||||
name varchar(300),
|
||||
gmt_created datetime default now(),
|
||||
id int,
|
||||
type int,
|
||||
gmt_modified datetime default now(),
|
||||
PRIMARY KEY (id)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroup_ob_000(
|
||||
adgroupid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
memberid int,
|
||||
cost int,
|
||||
campaignid int,
|
||||
favitemtotal int,
|
||||
fifteendirecttransactionshipping int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
fifteenfavitemtotal int,
|
||||
thedate datetime(6),
|
||||
isshop int,
|
||||
fifteenfavshoptotal int,
|
||||
custid int,
|
||||
click int,
|
||||
onefavshoptotal int,
|
||||
invalidclick int,
|
||||
network int,
|
||||
directtransaction int,
|
||||
oneindirecttransactionshipping int,
|
||||
directtransactionshipping int,
|
||||
matchscope int,
|
||||
threefavitemtotal int,
|
||||
favshoptotal int,
|
||||
onedirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
oneindirecttransaction int,
|
||||
searchtype int,
|
||||
auctionid int,
|
||||
fifteendirecttransaction int,
|
||||
threedirecttransactionshipping int,
|
||||
sevenfavitemtotal int,
|
||||
creativeid int,
|
||||
threefavshoptotal int,
|
||||
impression int,
|
||||
threeindirecttransactionshipping int,
|
||||
ranksum int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransaction int,
|
||||
indirecttransaction int,
|
||||
fifteenindirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
sevendirecttransaction int,
|
||||
onefavitemtotal int,
|
||||
indirecttransactionshipping int,
|
||||
onedirecttransactionshipping int,
|
||||
sevenindirecttransaction int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,creativeid,network,matchscope,searchtype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_dim_000(
|
||||
gmt_modified datetime default now(),
|
||||
id int,
|
||||
name varchar(300),
|
||||
gmt_created datetime default now(),
|
||||
PRIMARY KEY (id)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroup_name_000(
|
||||
title varchar(1024),
|
||||
custid int,
|
||||
adgroupid int,
|
||||
memberid int,
|
||||
campaignid int,
|
||||
imgurl varchar(1024),
|
||||
auctionid int,
|
||||
thedate datetime(6),
|
||||
isshop int,
|
||||
linkurl varchar(1024),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_price_000(
|
||||
indirecttransaction int,
|
||||
competition int,
|
||||
mechanism int,
|
||||
directtransaction int,
|
||||
ext1 int,
|
||||
indirecttransactionshipping int,
|
||||
network int,
|
||||
bidwordstr varchar(300),
|
||||
impression int,
|
||||
ext2 int,
|
||||
click int,
|
||||
pricedistribution int,
|
||||
thedate datetime(6),
|
||||
directtransactionshipping int,
|
||||
bidwordhash int,
|
||||
favshoptotal int,
|
||||
cost int,
|
||||
favitemtotal int,
|
||||
PRIMARY KEY (bidwordhash,thedate,pricedistribution,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_sexpowerstar_ob_000(
|
||||
directtransaction int,
|
||||
invalidclick int,
|
||||
onefavshoptotal int,
|
||||
click int,
|
||||
custid int,
|
||||
fifteenfavshoptotal int,
|
||||
fifteenfavitemtotal int,
|
||||
thedate datetime(6),
|
||||
fifteenindirecttransactionshipping int,
|
||||
fifteendirecttransactionshipping int,
|
||||
demographicstarid int,
|
||||
demographicsexid int,
|
||||
favitemtotal int,
|
||||
campaignid int,
|
||||
cost int,
|
||||
memberid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
sevenindirecttransaction int,
|
||||
onefavitemtotal int,
|
||||
indirecttransactionshipping int,
|
||||
onedirecttransactionshipping int,
|
||||
sevendirecttransaction int,
|
||||
fifteenindirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
indirecttransaction int,
|
||||
threeindirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransactionshipping int,
|
||||
impression int,
|
||||
threefavshoptotal int,
|
||||
sevenfavitemtotal int,
|
||||
threedirecttransactionshipping int,
|
||||
fifteendirecttransaction int,
|
||||
demographicpurchaseid int,
|
||||
threedirecttransaction int,
|
||||
oneindirecttransaction int,
|
||||
onedirecttransaction int,
|
||||
favshoptotal int,
|
||||
threefavitemtotal int,
|
||||
directtransactionshipping int,
|
||||
oneindirecttransactionshipping int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,demographicsexid,demographicpurchaseid,demographicstarid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_campaign_name_000(
|
||||
memeberid int,
|
||||
thedate datetime(6),
|
||||
campaignid int,
|
||||
campaigintitle varchar(1024),
|
||||
custid int,
|
||||
campaigntype int,
|
||||
PRIMARY KEY (custid,thedate,campaignid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_000(
|
||||
mechanism int,
|
||||
competition int,
|
||||
indirecttransaction int,
|
||||
ext1 int,
|
||||
indirecttransactionshipping int,
|
||||
network int,
|
||||
directtransaction int,
|
||||
impression int,
|
||||
bidwordstr varchar(512),
|
||||
click int,
|
||||
ext2 int,
|
||||
thedate datetime(6),
|
||||
bidwordhash int,
|
||||
directtransactionshipping int,
|
||||
favitemtotal int,
|
||||
cost int,
|
||||
favshoptotal int,
|
||||
PRIMARY KEY (bidwordhash,thedate,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_category_000(
|
||||
click int,
|
||||
ext2 int,
|
||||
bidwordstr varchar(300),
|
||||
impression int,
|
||||
indirecttransactionshipping int,
|
||||
ext1 int,
|
||||
network int,
|
||||
directtransaction int,
|
||||
indirecttransaction int,
|
||||
mechanism int,
|
||||
competition int,
|
||||
favshoptotal int,
|
||||
cost int,
|
||||
favitemtotal int,
|
||||
directtransactionshipping int,
|
||||
bidwordhash int,
|
||||
thedate datetime(6),
|
||||
category int,
|
||||
PRIMARY KEY (category,bidwordhash,thedate,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_sex_000(
|
||||
name varchar(100),
|
||||
thedate datetime(6),
|
||||
demographicid int,
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_pos_ob_000(
|
||||
threedirecttransactionshipping int,
|
||||
fifteendirecttransaction int,
|
||||
auctionid int,
|
||||
oneindirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
dimid int,
|
||||
onedirecttransaction int,
|
||||
favshoptotal int,
|
||||
threefavitemtotal int,
|
||||
oneindirecttransactionshipping int,
|
||||
directtransactionshipping int,
|
||||
sevenindirecttransaction int,
|
||||
onedirecttransactionshipping int,
|
||||
indirecttransactionshipping int,
|
||||
onefavitemtotal int,
|
||||
sevendirecttransaction int,
|
||||
fifteenindirecttransaction int,
|
||||
sevenfavshoptotal int,
|
||||
indirecttransaction int,
|
||||
threeindirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransactionshipping int,
|
||||
impression int,
|
||||
threefavshoptotal int,
|
||||
placeid int,
|
||||
sevenfavitemtotal int,
|
||||
fifteenfavshoptotal int,
|
||||
isshop int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
fifteenfavitemtotal int,
|
||||
thedate datetime(6),
|
||||
fifteendirecttransactionshipping int,
|
||||
favitemtotal int,
|
||||
cost int,
|
||||
campaignid int,
|
||||
memberid int,
|
||||
sevenindirecttransactionshipping int,
|
||||
adgroupid int,
|
||||
directtransaction int,
|
||||
invalidclick int,
|
||||
onefavshoptotal int,
|
||||
click int,
|
||||
custid int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,placeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_campaign_ob_000(
|
||||
searchtype int,
|
||||
oneindirecttransaction int,
|
||||
threedirecttransaction int,
|
||||
threedirecttransactionshipping int,
|
||||
fifteendirecttransaction int,
|
||||
threefavitemtotal int,
|
||||
matchscope int,
|
||||
directtransactionshipping int,
|
||||
oneindirecttransactionshipping int,
|
||||
onedirecttransaction int,
|
||||
favshoptotal int,
|
||||
sevenfavshoptotal int,
|
||||
fifteenindirecttransaction int,
|
||||
sevendirecttransaction int,
|
||||
sevendirecttransactionshipping int,
|
||||
threeindirecttransaction int,
|
||||
indirecttransaction int,
|
||||
onefavitemtotal int,
|
||||
indirecttransactionshipping int,
|
||||
onedirecttransactionshipping int,
|
||||
sevenindirecttransaction int,
|
||||
threefavshoptotal int,
|
||||
impression int,
|
||||
sevenfavitemtotal int,
|
||||
ranksum int,
|
||||
threeindirecttransactionshipping int,
|
||||
fifteendirecttransactionshipping int,
|
||||
fifteenfavshoptotal int,
|
||||
isshop int,
|
||||
fifteenfavitemtotal int,
|
||||
fifteenindirecttransactionshipping int,
|
||||
thedate datetime(6),
|
||||
sevenindirecttransactionshipping int,
|
||||
memberid int,
|
||||
favitemtotal int,
|
||||
campaignid int,
|
||||
cost int,
|
||||
invalidclick int,
|
||||
network int,
|
||||
directtransaction int,
|
||||
onefavshoptotal int,
|
||||
custid int,
|
||||
click int,
|
||||
PRIMARY KEY (custid,thedate,campaignid,network,matchscope,searchtype,isshop)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_area_name_000(
|
||||
cityid int,
|
||||
cityname varchar(100),
|
||||
provinceid int,
|
||||
provincename varchar(100),
|
||||
PRIMARY KEY (provinceid,cityid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
drop database createsql;
|
||||
737
tools/deploy/mysql_test/t/createvarchar.test
Normal file
737
tools/deploy/mysql_test/t/createvarchar.test
Normal file
@ -0,0 +1,737 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: jim.wjh
|
||||
#owner group: sql2
|
||||
#description: todo
|
||||
--disable_warnings
|
||||
drop database if exists createvarchar;
|
||||
--enable_warnings
|
||||
create database createvarchar;
|
||||
use createvarchar;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_shishi_000(
|
||||
thedate datetime(6),
|
||||
puttype varchar(124),
|
||||
sourcetype varchar(124),
|
||||
clickprice varchar(124),
|
||||
click varchar(124),
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_feed_bidword_ob_000(
|
||||
bidwordid varchar(124),
|
||||
searchtype varchar(124),
|
||||
thedate datetime(6),
|
||||
adgroupid varchar(124),
|
||||
freeclick varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
matchscope varchar(124),
|
||||
memberid varchar(124),
|
||||
feedid varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
cost varchar(124),
|
||||
campaignid varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
gmt_created datetime default now(),
|
||||
gmt_modified datetime default now(),
|
||||
directtransaction varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
network varchar(124),
|
||||
invalidclick varchar(124),
|
||||
bidwordstr varchar(300),
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
itemid varchar(124),
|
||||
click varchar(124),
|
||||
ranksum varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,bidwordid,feedid,network,matchscope)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_lixian_000(
|
||||
thedate datetime(6),
|
||||
sourcetype varchar(124),
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
puttype varchar(124),
|
||||
campaignid varchar(124),
|
||||
clickprice varchar(124),
|
||||
click varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_bidword_ob_000(
|
||||
click varchar(124),
|
||||
bidwordstr varchar(300),
|
||||
custid varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
directtransaction varchar(124),
|
||||
invalidclick varchar(124),
|
||||
network varchar(124),
|
||||
campaignid varchar(124),
|
||||
cost varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
adgroupid varchar(124),
|
||||
memberid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
isshop varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
ranksum varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
impression varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
matchscope varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
bidwordid varchar(124),
|
||||
searchtype varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,bidwordid,network,matchscope)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroupplace_name_000(
|
||||
placeid varchar(124),
|
||||
placename varchar(100),
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (placeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_shishi_accumulative_000(
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
sourcetype varchar(124),
|
||||
puttype varchar(124),
|
||||
thedate datetime(6),
|
||||
clickprice varchar(124),
|
||||
click varchar(124),
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_querysession_ob_000(
|
||||
relword varchar(3000),
|
||||
originalword varchar(300),
|
||||
PRIMARY KEY (originalword)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_area_ob_000(
|
||||
onedirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
provinceid varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
ext2 varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
impression varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
ext1 varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
cityid varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
productid varchar(124),
|
||||
campaignid varchar(124),
|
||||
cost varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
memberid varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
click varchar(124),
|
||||
traffictype varchar(124),
|
||||
custid varchar(124),
|
||||
invalidclick varchar(124),
|
||||
productline varchar(124),
|
||||
directtransaction varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
mechanism varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,traffictype,mechanism,provinceid,cityid,productline,productid,ext1,ext2)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_area_000(
|
||||
indirecttransaction varchar(124),
|
||||
mechanism varchar(124),
|
||||
competition varchar(124),
|
||||
area varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
network varchar(124),
|
||||
ext1 varchar(124),
|
||||
directtransaction varchar(124),
|
||||
bidwordstr varchar(300),
|
||||
impression varchar(124),
|
||||
click varchar(124),
|
||||
ext2 varchar(124),
|
||||
thedate datetime(6),
|
||||
directtransactionshipping varchar(124),
|
||||
bidwordhash varchar(124),
|
||||
cost varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
PRIMARY KEY (bidwordhash,thedate,area,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_feed_name_000(
|
||||
gmt_created datetime default now(),
|
||||
gmt_modified datetime default now(),
|
||||
thedate datetime(6),
|
||||
linkurl varchar(124),
|
||||
adgroupid varchar(124),
|
||||
custid varchar(124),
|
||||
title varchar(124),
|
||||
memberid varchar(124),
|
||||
imgurl varchar(124),
|
||||
feedid varchar(124),
|
||||
campaignid varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,feedid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_lixian_accumulative_000(
|
||||
clickprice varchar(124),
|
||||
click varchar(124),
|
||||
sourcetype varchar(124),
|
||||
puttype varchar(124),
|
||||
thedate datetime(6),
|
||||
impression varchar(124),
|
||||
custid varchar(124),
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_creative_name_000(
|
||||
is_shop varchar(124),
|
||||
thedate datetime(6),
|
||||
linkurl varchar(124),
|
||||
adgroupid varchar(124),
|
||||
title varchar(124),
|
||||
custid varchar(124),
|
||||
creativeid varchar(124),
|
||||
memberid varchar(124),
|
||||
imgurl varchar(124),
|
||||
campaignid varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,creativeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_000(
|
||||
name varchar(100),
|
||||
demographicid varchar(124),
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_star_000(
|
||||
thedate datetime(6),
|
||||
demographicid varchar(124),
|
||||
name varchar(100),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_solar_item_ob_000(
|
||||
indirecttransactionshipping varchar(124),
|
||||
ext1 varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
productlineid varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
ranksum varchar(124),
|
||||
ext2 varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
impression varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
creativeid varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
searchtype varchar(124),
|
||||
rptext2 varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
entityid varchar(124),
|
||||
creativepv varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
invalidclick varchar(124),
|
||||
directtransaction varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
rptext1 varchar(124),
|
||||
click varchar(124),
|
||||
traffictype varchar(124),
|
||||
custid varchar(124),
|
||||
entitytype varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
productid varchar(124),
|
||||
cost varchar(124),
|
||||
areaid varchar(124),
|
||||
campaignid varchar(124),
|
||||
feedid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
memberid varchar(124),
|
||||
adgroupid varchar(124),
|
||||
PRIMARY KEY (memberid,thedate,productlineid,campaignid,adgroupid,creativeid,areaid,entityid,entitytype,traffictype,searchtype,productid,ext1,ext2)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_p4p_bidword_normtoorigin_000(
|
||||
normalword varchar(300),
|
||||
originalword varchar(300),
|
||||
PRIMARY KEY (normalword)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_lixian_accumulative_000(
|
||||
click varchar(124),
|
||||
clickprice varchar(124),
|
||||
puttype varchar(124),
|
||||
campaignid varchar(124),
|
||||
impression varchar(124),
|
||||
custid varchar(124),
|
||||
thedate datetime(6),
|
||||
sourcetype varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_custid_lixian_000(
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
sourcetype varchar(124),
|
||||
puttype varchar(124),
|
||||
thedate datetime(6),
|
||||
click varchar(124),
|
||||
clickprice varchar(124),
|
||||
PRIMARY KEY (custid,thedate,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_shishi_000(
|
||||
thedate datetime(6),
|
||||
sourcetype varchar(124),
|
||||
custid varchar(124),
|
||||
impression varchar(124),
|
||||
campaignid varchar(124),
|
||||
puttype varchar(124),
|
||||
click varchar(124),
|
||||
clickprice varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_chenfeng_campaignid_shishi_accumulative_000(
|
||||
clickprice varchar(124),
|
||||
click varchar(124),
|
||||
puttype varchar(124),
|
||||
campaignid varchar(124),
|
||||
impression varchar(124),
|
||||
custid varchar(124),
|
||||
sourcetype varchar(124),
|
||||
thedate datetime(6),
|
||||
PRIMARY KEY (custid,thedate,campaignid,puttype,sourcetype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_custom_ob_000(
|
||||
oneindirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
impression varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
ranksum varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
memberid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
cost varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
directtransaction varchar(124),
|
||||
invalidclick varchar(124),
|
||||
custid varchar(124),
|
||||
click varchar(124),
|
||||
PRIMARY KEY (custid,thedate)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_purchase_000(
|
||||
demographicid varchar(124),
|
||||
thedate datetime(6),
|
||||
name varchar(100),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_tag_000(
|
||||
name varchar(300),
|
||||
gmt_created datetime default now(),
|
||||
id varchar(124),
|
||||
type varchar(124),
|
||||
gmt_modified datetime default now(),
|
||||
PRIMARY KEY (id)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroup_ob_000(
|
||||
adgroupid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
memberid varchar(124),
|
||||
cost varchar(124),
|
||||
campaignid varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
thedate datetime(6),
|
||||
isshop varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
custid varchar(124),
|
||||
click varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
invalidclick varchar(124),
|
||||
network varchar(124),
|
||||
directtransaction varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
matchscope varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
searchtype varchar(124),
|
||||
auctionid varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
creativeid varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
impression varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
ranksum varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,creativeid,network,matchscope,searchtype)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_dim_000(
|
||||
gmt_modified datetime default now(),
|
||||
id varchar(124),
|
||||
name varchar(300),
|
||||
gmt_created datetime default now(),
|
||||
PRIMARY KEY (id)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_adgroup_name_000(
|
||||
title varchar(124),
|
||||
custid varchar(124),
|
||||
adgroupid varchar(124),
|
||||
memberid varchar(124),
|
||||
campaignid varchar(124),
|
||||
imgurl varchar(124),
|
||||
auctionid varchar(124),
|
||||
thedate datetime(6),
|
||||
isshop varchar(124),
|
||||
linkurl varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_price_000(
|
||||
indirecttransaction varchar(124),
|
||||
competition varchar(124),
|
||||
mechanism varchar(124),
|
||||
directtransaction varchar(124),
|
||||
ext1 varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
network varchar(124),
|
||||
bidwordstr varchar(300),
|
||||
impression varchar(124),
|
||||
ext2 varchar(124),
|
||||
click varchar(124),
|
||||
pricedistribution varchar(124),
|
||||
thedate datetime(6),
|
||||
directtransactionshipping varchar(124),
|
||||
bidwordhash varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
cost varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
PRIMARY KEY (bidwordhash,thedate,pricedistribution,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_sexpowerstar_ob_000(
|
||||
directtransaction varchar(124),
|
||||
invalidclick varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
click varchar(124),
|
||||
custid varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
demographicstarid varchar(124),
|
||||
demographicsexid varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
campaignid varchar(124),
|
||||
cost varchar(124),
|
||||
memberid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
impression varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
demographicpurchaseid varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,demographicsexid,demographicpurchaseid,demographicstarid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_campaign_name_000(
|
||||
memeberid varchar(124),
|
||||
thedate datetime(6),
|
||||
campaignid varchar(124),
|
||||
campaigintitle varchar(124),
|
||||
custid varchar(124),
|
||||
campaigntype varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_000(
|
||||
mechanism varchar(124),
|
||||
competition varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
ext1 varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
network varchar(124),
|
||||
directtransaction varchar(124),
|
||||
impression varchar(124),
|
||||
bidwordstr varchar(512),
|
||||
click varchar(124),
|
||||
ext2 varchar(124),
|
||||
thedate datetime(6),
|
||||
bidwordhash varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
cost varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
PRIMARY KEY (bidwordhash,thedate,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_insight_bidword_category_000(
|
||||
click varchar(124),
|
||||
ext2 varchar(124),
|
||||
bidwordstr varchar(300),
|
||||
impression varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
ext1 varchar(124),
|
||||
network varchar(124),
|
||||
directtransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
mechanism varchar(124),
|
||||
competition varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
cost varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
bidwordhash varchar(124),
|
||||
thedate datetime(6),
|
||||
category varchar(124),
|
||||
PRIMARY KEY (category,bidwordhash,thedate,network,mechanism,ext1,ext2,bidwordstr)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_demographic_name_sex_000(
|
||||
name varchar(100),
|
||||
thedate datetime(6),
|
||||
demographicid varchar(124),
|
||||
PRIMARY KEY (demographicid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_pos_ob_000(
|
||||
threedirecttransactionshipping varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
auctionid varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
dimid varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
impression varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
placeid varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
isshop varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
thedate datetime(6),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
cost varchar(124),
|
||||
campaignid varchar(124),
|
||||
memberid varchar(124),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
adgroupid varchar(124),
|
||||
directtransaction varchar(124),
|
||||
invalidclick varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
click varchar(124),
|
||||
custid varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,adgroupid,placeid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_campaign_ob_000(
|
||||
searchtype varchar(124),
|
||||
oneindirecttransaction varchar(124),
|
||||
threedirecttransaction varchar(124),
|
||||
threedirecttransactionshipping varchar(124),
|
||||
fifteendirecttransaction varchar(124),
|
||||
threefavitemtotal varchar(124),
|
||||
matchscope varchar(124),
|
||||
directtransactionshipping varchar(124),
|
||||
oneindirecttransactionshipping varchar(124),
|
||||
onedirecttransaction varchar(124),
|
||||
favshoptotal varchar(124),
|
||||
sevenfavshoptotal varchar(124),
|
||||
fifteenindirecttransaction varchar(124),
|
||||
sevendirecttransaction varchar(124),
|
||||
sevendirecttransactionshipping varchar(124),
|
||||
threeindirecttransaction varchar(124),
|
||||
indirecttransaction varchar(124),
|
||||
onefavitemtotal varchar(124),
|
||||
indirecttransactionshipping varchar(124),
|
||||
onedirecttransactionshipping varchar(124),
|
||||
sevenindirecttransaction varchar(124),
|
||||
threefavshoptotal varchar(124),
|
||||
impression varchar(124),
|
||||
sevenfavitemtotal varchar(124),
|
||||
ranksum varchar(124),
|
||||
threeindirecttransactionshipping varchar(124),
|
||||
fifteendirecttransactionshipping varchar(124),
|
||||
fifteenfavshoptotal varchar(124),
|
||||
isshop varchar(124),
|
||||
fifteenfavitemtotal varchar(124),
|
||||
fifteenindirecttransactionshipping varchar(124),
|
||||
thedate datetime(6),
|
||||
sevenindirecttransactionshipping varchar(124),
|
||||
memberid varchar(124),
|
||||
favitemtotal varchar(124),
|
||||
campaignid varchar(124),
|
||||
cost varchar(124),
|
||||
invalidclick varchar(124),
|
||||
network varchar(124),
|
||||
directtransaction varchar(124),
|
||||
onefavshoptotal varchar(124),
|
||||
custid varchar(124),
|
||||
click varchar(124),
|
||||
PRIMARY KEY (custid,thedate,campaignid,network,matchscope,searchtype,isshop)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rpt_bpp4p_area_name_000(
|
||||
cityid varchar(124),
|
||||
cityname varchar(100),
|
||||
provinceid varchar(124),
|
||||
provincename varchar(100),
|
||||
PRIMARY KEY (provinceid,cityid)
|
||||
) COMPRESSION='lz4_1.0' ;
|
||||
|
||||
set @@recyclebin = off;
|
||||
drop database createvarchar;
|
||||
29
tools/deploy/mysql_test/t/datatype_java.test
Normal file
29
tools/deploy/mysql_test/t/datatype_java.test
Normal file
@ -0,0 +1,29 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL3
|
||||
# Test of datatype functions for java mode
|
||||
|
||||
set sql_mode='';
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(id int primary key auto_increment,
|
||||
int_val smallint,
|
||||
uint_val smallint unsigned,
|
||||
flt_val float(5, 3),
|
||||
dbl_val double(7, 4),
|
||||
dec_val decimal(5, 3),
|
||||
vc_val varchar(2));
|
||||
insert into t(int_val, uint_val, flt_val, dbl_val, dec_val, vc_val) values
|
||||
( 184467440737095516150, 184467440737095516150, 12345.67890, 12345.67890, '12345.67890', '123456789'),
|
||||
(-184467440737095516150, -184467440737095516150, 0.444444, 0.444444, '98.76abc', '987654321'),
|
||||
(NULL, NULL, -0.555555, -0.555555, 'abc', '阿里巴巴');
|
||||
--replace_column 1 auto_increment_id
|
||||
select * from t order by id;
|
||||
update t set int_val = 123456789, uint_val = -123456789, flt_val = 98765.43210, dbl_val = 98765.43210, dec_val = 98765.43210, vc_val = '支付宝';
|
||||
--replace_column 1 auto_increment_id
|
||||
select * from t order by id limit 1;
|
||||
select 4/3, 4/3*1000000 + 1, 4.00000/3*1000000000 + 1, 4.000000/3*1000000000 + 1, 4/3 = 1.3333, 4/3 = 1.333333333, length(4/3);
|
||||
drop table t;
|
||||
75
tools/deploy/mysql_test/t/ddlrollback.test
Normal file
75
tools/deploy/mysql_test/t/ddlrollback.test
Normal file
@ -0,0 +1,75 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# tags: ddl
|
||||
# description:
|
||||
#
|
||||
####ddl要自动提交(之前未提交的数据也会一并提交)
|
||||
--disable_warnings
|
||||
drop database if exists jx_db;
|
||||
--enable_warnings
|
||||
create database jx_db;
|
||||
use jx_db;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2,t3;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int primary key, c2 int);
|
||||
set autocommit=0;
|
||||
insert into t1 values(1,1);
|
||||
create table t2 (c1 int primary key, c2 int);
|
||||
rollback;
|
||||
select * from t1;
|
||||
desc t2;
|
||||
set autocommit=1;
|
||||
begin;
|
||||
insert into t1 values(2,2);
|
||||
create table t3 (c1 int primary key, c2 int);
|
||||
rollback;
|
||||
select * from t1;
|
||||
desc t3;
|
||||
|
||||
create table ddl_t(c int);
|
||||
set autocommit = off;
|
||||
insert into ddl_t values(3);
|
||||
alter table ddl_t add column c2 int;
|
||||
select * from ddl_t;
|
||||
rollback;
|
||||
select * from ddl_t;
|
||||
|
||||
# ddl执行失败
|
||||
create table jx_t1(c int);
|
||||
set autocommit = off;
|
||||
insert into jx_t1 values(4);
|
||||
--error 1050
|
||||
create table jx_t1(c int);
|
||||
select * from jx_t1;
|
||||
rollback;
|
||||
select * from jx_t1;
|
||||
|
||||
create table jx_t2(c int);
|
||||
set autocommit = off;
|
||||
insert into jx_t2 values(5);
|
||||
--disable_warnings
|
||||
create user if not exists jx_user;
|
||||
--enable_warnings
|
||||
select * from jx_t2;
|
||||
rollback;
|
||||
select * from jx_t2;
|
||||
|
||||
# dcl执行失败
|
||||
create table jx_t3(c int);
|
||||
set autocommit = off;
|
||||
insert into jx_t3 values(6);
|
||||
--error 1396
|
||||
create user jx_user;
|
||||
select * from jx_t3;
|
||||
rollback;
|
||||
select * from jx_t3;
|
||||
|
||||
set autocommit = on;
|
||||
drop user jx_user;
|
||||
|
||||
drop database jx_db;
|
||||
14
tools/deploy/mysql_test/t/diag_tenant.test
Normal file
14
tools/deploy/mysql_test/t/diag_tenant.test
Normal file
@ -0,0 +1,14 @@
|
||||
# owner: fengshuo.fs
|
||||
# owner group: VOS
|
||||
# description: 简单测试diagnose租户mysql模式下可用性
|
||||
|
||||
let $__tenant_name__ = 'mysql';
|
||||
--source mysql_test/include/get_tenant_server.inc
|
||||
|
||||
connect (conn_sys,$TE_SERVER_IP,sys@diag,,test,$TE_SERVER_PORT);
|
||||
connection conn_sys;
|
||||
select 1 from dual;
|
||||
|
||||
connect (conn_mysql,$TE_SERVER_IP,mysql@diag,,test,$TE_SERVER_PORT);
|
||||
connection conn_mysql;
|
||||
select 1 from dual;
|
||||
161
tools/deploy/mysql_test/t/dist_nest_loop_simple.test
Normal file
161
tools/deploy/mysql_test/t/dist_nest_loop_simple.test
Normal file
@ -0,0 +1,161 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: linlin.xll
|
||||
#owner group: sql2
|
||||
#description:
|
||||
#tags: join,optimizer
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists yy;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t4;
|
||||
drop table if exists t5;
|
||||
drop table if exists t6;
|
||||
drop table if exists t11;
|
||||
drop table if exists t12;
|
||||
drop table if exists t13;
|
||||
drop table if exists t15;
|
||||
--enable_warnings
|
||||
|
||||
create database yy;
|
||||
use yy;
|
||||
create table t1(c1 int(11) , c2 int(11) , c3 int(11), primary key (c2, c3)) partition by range columns(c2, c3) (partition p0 values less than (1,1), partition p1 values less than (100,100));
|
||||
create table t2(c1 int(11) not null, c2 int(11) not null, c3 int(11) not null, primary key (c1, c2, c3)) partition by hash(c1) partitions 2;
|
||||
create table t11(c1 int primary key, c2 int) partition by hash (c1) partitions 5;
|
||||
create table t12(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 3;
|
||||
create table t13(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 2;
|
||||
create index idx_t11_c2 on t11(c2) LOCAL;
|
||||
create table t15(c1 int, c2 int, c3 int, primary key(c2,c3)) partition by key(c2, c3) partitions 3;
|
||||
create index idx_t15_c2 on t15(c2) LOCAL;
|
||||
create index idx_t15_c3 on t15(c3) LOCAL;
|
||||
|
||||
|
||||
##this will not be repart so far, because range columns(c2,c3) will be allowed later
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c2= t2.c2 and t1.c3= t2.c3;
|
||||
|
||||
drop table t1;
|
||||
create table t1 (c1 int(11) , c2 int(11) , c3 int(11), primary key (c2, c3)) partition by key(c2) partitions 2;
|
||||
##this will not be repart so far, key partition type is not allowed so far will be allowed later
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c2= t2.c2 and t1.c3= t2.c3;
|
||||
|
||||
drop table t1;
|
||||
create table t1 (c1 int(11) , c2 int(11) , c3 int(11), c4 date, primary key (c2, c3)) partition by range columns(c2)
|
||||
(partition p0 values less than (1), partition p1 values less than (100));
|
||||
|
||||
|
||||
#####below will be not repart
|
||||
## not nest loop
|
||||
explain select * from t1 join t2 on t1.c2= t2.c2;
|
||||
##partition key is not covered by join key
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 join t2 on t1.c3= t2.c3;
|
||||
explain select /*+use_bnl(t1 t2)*/ * from t1 join t2 on t1.c3= t2.c3;
|
||||
|
||||
|
||||
####below will be repart
|
||||
#right repart both sharding
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c2= t2.c2;
|
||||
#left repart both sharding
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c1= t2.c1;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c2= t2.c2 and t1.c3= t2.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 left join t2 on t1.c1= t2.c1 and t1.c3= t2.c3;
|
||||
#right repart ,left is sharding
|
||||
#left repart ,right is sharding
|
||||
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 join t2 on t1.c2= t2.c2;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 join t2 on t1.c1= t2.c1;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t2)*/ * from t1 join t2 on t1.c2= t2.c2 and t1.c3= t2.c3;
|
||||
|
||||
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select c1 from t11 where c2 not in (select c2 from t11);
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select c1 from t12 where c1 not in (select c1 from t11 where c2 not in (select c2 from t11));
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select * from (select /*+use_nl(t11 t12)*/ t12.c1 from t11,t12 where t11.c1=t12.c1 limit 1) v order by v.c1;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select count(c1) from t11 group by c1 having c1 in (select t12.c1 from t12 where t11.c1=t12.c2);
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select * from t11 where c1 in (select c1 from t12 where (1 = 0 or c1 > 5));
|
||||
|
||||
#part key is generated column,which will not be true, part key need to be primary key, but primary key is not supported as generate columns so far
|
||||
|
||||
#####part_level_two
|
||||
create table t4 (c1 int, c2 int, c3 date, c4 int, primary key(c1,c2,c3)) partition by hash(c1) subpartition by range columns(c3)
|
||||
subpartition template( subpartition p_2016_11_02_00 values less than ('2016-11-02'),
|
||||
subpartition p_2016_11_03_00 values less than ('2016-11-03'),
|
||||
subpartition p_max_value values less than (MAXVALUE));
|
||||
|
||||
create table t5(c1 int, c2 int, c3 date, c4 int, primary key(c1,c2,c3)) partition by hash(c1) subpartition by range columns(c3)
|
||||
subpartition template( subpartition p_2016_11_02_00 values less than ('2016-11-02'),
|
||||
subpartition p_2016_11_03_00 values less than ('2016-11-03'),
|
||||
subpartition p_max_value values less than (MAXVALUE));
|
||||
|
||||
create table t6(c1 int, c2 int, c3 date, c4 int, primary key(c1,c2,c3)) partition by hash(c1) subpartition by range columns(c3)
|
||||
subpartition template( subpartition p_2016_11_02_00 values less than ('2016-11-02'),
|
||||
subpartition p_2016_11_03_00 values less than ('2016-11-03'),
|
||||
subpartition p_max_value values less than (MAXVALUE));
|
||||
|
||||
####below will be not repart
|
||||
explain select /*+use_nl(t4 t5)*/ * from t4 left join t5 on t4.c2= t5.c2;
|
||||
explain select /*+use_nl(t4 t5)*/ * from t4 left join t5 on t4.c1= t5.c1;
|
||||
explain select /*+use_nl(t4 t5)*/ * from t4 join t5 on t4.c2= t5.c2 and t4.c3= t5.c3;
|
||||
explain select * from t4 left join t5 on t4.c1= t5.c1 and t4.c3 = t5.c3;
|
||||
|
||||
|
||||
#right repart both sharding
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t4 t5)*/ * from t4 left join t5 on t4.c1= t5.c2 and t4.c3 = t5.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t4 t1)*/ * from t4 left join t1 on t4.c1= t1.c1 and t4.c3 = t1.c4;
|
||||
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t5 t4)*/ * from t5 left join t4 on t4.c1= t5.c2 and t4.c3 = t5.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t1 t4)*/ * from t1 left join t4 on t4.c1= t1.c1 and t4.c3 = t1.c4;
|
||||
|
||||
#left repart both sharding left repart is prior to right repart, when both is available
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(t4 t5)*/ * from t4 left join t5 on t4.c1= t5.c1 and t4.c3 = t5.c3;
|
||||
|
||||
#subplan and join
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select * from (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as a join t5 as b on a.c1 = b.c1 and a.c3 = b.c3 join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select * from t5 as a join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as b on a.c1 = b.c1 and a.c3 = b.c3 join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select * from t5 as a join t6 as b on a.c1 = b.c1 and a.c3 = b.c3 join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as a join t5 as b on a.c1 = b.c1 and a.c3 = b.c3 join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from t5 as a join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as b on a.c1 = b.c1 and a.c3 = b.c3 join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from t5 as a join t6 as b on a.c1 = b.c1 and a.c3 = b.c3 join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 2) as a left join t5 as b on a.c1 = b.c1 and a.c3 = b.c3 left join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from t5 as a left join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as b on a.c1 = b.c1 and a.c3 = b.c3 left join t6 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(a b) use_nl(b c)*/ * from t5 as a left join t6 as b on a.c1 = b.c1 and a.c3 = b.c3 left join (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 1) as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(c)*/ * from t5 as a left join t6 as b on a.c1 = b.c1 and a.c3 = b.c3 left join t4 as c on b.c1=c.c1 and b.c3 = c.c3;
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_nl(c)*/ * from t5 as a left join t6 as b on a.c1 = b.c1 and a.c3 = b.c3 left join t4 as c on b.c1=c.c1 and b.c3 = c.c3 limit 100;
|
||||
|
||||
|
||||
###suplan filter
|
||||
##bnl should not be repart
|
||||
--replace_regex /repart_table_id_:[0-9]*/repart_table_id_:TABLE_ID/
|
||||
explain select /*+use_bnl(a b)*/ * from (select c1, c3, sum(c2) as yyy, max(c4) from t4 group by c3 order by yyy limit 2) as a left join t5 as b on a.c1 = b.c1 and a.c3 = b.c3 ;
|
||||
drop database yy;
|
||||
19
tools/deploy/mysql_test/t/distinct.test
Normal file
19
tools/deploy/mysql_test/t/distinct.test
Normal file
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: bin.lb
|
||||
#owner group: sql1
|
||||
#tags: group_by
|
||||
#description:
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(a int primary key,b int,c int);
|
||||
insert into test values(1,4,null);
|
||||
insert into test values(3,3,null);
|
||||
insert into test values(4,3,null);
|
||||
select avg(distinct(a)),avg(a),avg(b) from test;
|
||||
select avg(distinct(b)),avg(b),avg(c) from test;
|
||||
select avg(c),avg(b),avg(distinct(b)) from test;
|
||||
select avg(c),avg(b),avg(b) from test;
|
||||
27
tools/deploy/mysql_test/t/driver5114_bug.test
Normal file
27
tools/deploy/mysql_test/t/driver5114_bug.test
Normal file
@ -0,0 +1,27 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(pk varchar(16000) , t timestamp(6) default "2012-01-01 12:00:00");
|
||||
|
||||
|
||||
let $a=abcdefghij;
|
||||
let $p=abcdefghij;
|
||||
let $cnt=1000;
|
||||
while($cnt)
|
||||
{
|
||||
let $a=$a$p;
|
||||
dec $cnt;
|
||||
}
|
||||
eval insert into t1 values('$a',timestamp'2012-12-12 12:12:12.123456');
|
||||
|
||||
select length(pk) from t1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
24
tools/deploy/mysql_test/t/duplicate_key.test
Normal file
24
tools/deploy/mysql_test/t/duplicate_key.test
Normal file
@ -0,0 +1,24 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: rkaizhan.dkz
|
||||
#owner group: sql1
|
||||
#tags: dml
|
||||
#description:
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t (c1 int primary key, c2 int);
|
||||
|
||||
--error 1062
|
||||
insert into t values(1,2),(3,4),(1,2);
|
||||
|
||||
insert into t values(1,2),(3,4),(5,6);
|
||||
select * from t;
|
||||
|
||||
select * from t where c1 in (1,3,1);
|
||||
|
||||
select * from t where c1 in (1,1);
|
||||
|
||||
drop table t;
|
||||
8
tools/deploy/mysql_test/t/empty_input.test
Normal file
8
tools/deploy/mysql_test/t/empty_input.test
Normal file
@ -0,0 +1,8 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# description:
|
||||
#
|
||||
/*!40101 SET SQL_MODE='' */;
|
||||
21
tools/deploy/mysql_test/t/empty_table.test
Normal file
21
tools/deploy/mysql_test/t/empty_table.test
Normal file
@ -0,0 +1,21 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
#
|
||||
# Some special cases with empty tables
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (nr int ,b char(30),str char(10), primary key (nr));
|
||||
select count(*) from t1;
|
||||
select * from t1;
|
||||
select * from t1 limit 0;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
14
tools/deploy/mysql_test/t/escape.test
Normal file
14
tools/deploy/mysql_test/t/escape.test
Normal file
@ -0,0 +1,14 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL1
|
||||
# description: foobar
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
create table t2 (c1 varchar(1024) primary key, c2 varchar(1024), c3 varchar(1024));
|
||||
replace into t2 values ('abc', '\\\\', 'DC');
|
||||
select * from t2;
|
||||
drop table t2;
|
||||
95
tools/deploy/mysql_test/t/except.test
Normal file
95
tools/deploy/mysql_test/t/except.test
Normal file
@ -0,0 +1,95 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# Test of functions except
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
create table t2(c1 int primary key, c2 int);
|
||||
create table t3(c1 int, c2 int primary key);
|
||||
create table t4(c1 int primary key, c2 int);
|
||||
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
insert into t2 values(0,0),(2,2),(4,4),(6,6);
|
||||
insert into t3 values(1,1),(3,3),(5,5),(7,7);
|
||||
insert into t4 values(1,0),(2,0),(3,1),(4,1);
|
||||
|
||||
#all same
|
||||
select * from t1 except select * from t1;
|
||||
--error 1064
|
||||
select * from t1 except all select * from t1;
|
||||
#partial same
|
||||
select * from t1 except select * from t2;
|
||||
--error 1064
|
||||
select * from t1 except all select * from t2;
|
||||
|
||||
#different schema
|
||||
select * from t1 except select * from t3;
|
||||
--error 1064
|
||||
select * from t1 except all select * from t3;
|
||||
|
||||
#constant
|
||||
select * from t1 except select 1,1 from t1;
|
||||
--error 1064
|
||||
select * from t1 except all select 1,1 from t1;
|
||||
|
||||
#has no same
|
||||
select * from t2 except select * from t3;
|
||||
--error 1064
|
||||
select * from t2 except all select * from t3;
|
||||
|
||||
#empty input
|
||||
(select * from t2) except (select * from t2 where false);
|
||||
--error 1064
|
||||
(select * from t2) except all (select * from t2 where false);
|
||||
(select * from t2 where false) except (select * from t2);
|
||||
(select * from t2 where false) except (select * from t2 where false);
|
||||
|
||||
#distinct
|
||||
select c2 from t4 except select 1 from t4;
|
||||
--error 1064
|
||||
select c2 from t4 except all select 1 from t4;
|
||||
select c2 from t4 except select 0 from t4;
|
||||
select c2 from t4 except select c2 from t4;
|
||||
select c2 from t4 except select distinct c2 from t4;
|
||||
select distinct c2 from t4 except select distinct c2 from t4;
|
||||
--error 1064
|
||||
select distinct c2 from t4 except all select distinct c2 from t4;
|
||||
select distinct c2 from t4 except select c2 from t4;
|
||||
--error 1064
|
||||
select distinct c2 from t4 except all select c2 from t4;
|
||||
|
||||
select 0 from t4 except select c2 from t4;
|
||||
select 1 from t4 except select 0 from t4;
|
||||
--error 1064
|
||||
select 1 from t4 except all select 0 from t4;
|
||||
|
||||
|
||||
# nest
|
||||
(select * from t4 except (select * from t4 where c1=1) )except (select * from t4 where c1=2);
|
||||
select * from t4 except (select * from t4 where c1=1) except (select * from t4 where c1=3);
|
||||
select * from t4 except select 1,0 from t4 except select 3,1 from t4;
|
||||
(select * from t4 where false) except (select * from t4 where false) except select * from t4;
|
||||
|
||||
select * from t4 except ((select * from t4 where c1=1) except (select * from t4 where c1=2));
|
||||
select * from t4 except ((select * from t4 where c1=1) union (select * from t4 where c1=2));
|
||||
--disable_warnings
|
||||
drop table if exists t5,t6;
|
||||
--enable_warnings
|
||||
create table t5(c1 int primary key, c2 int);
|
||||
create table t6(c1 int primary key, c2 int);
|
||||
|
||||
insert into t5 values(1,1),(2,2),(3,3),(4,4),(5,5),(6,2),(7,3),(8,6);
|
||||
insert into t6 values(0,0),(2,2),(4,4),(6,6);
|
||||
select c2 from t5 except select c2 from t6;
|
||||
--error 1064
|
||||
select c2 from t5 except all select c2 from t6;
|
||||
|
||||
|
||||
drop table t1,t2,t3,t4,t5,t6;
|
||||
78
tools/deploy/mysql_test/t/explain.test
Normal file
78
tools/deploy/mysql_test/t/explain.test
Normal file
@ -0,0 +1,78 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
# tags: optimizer, outline
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(a int,b int primary key);
|
||||
insert into test values(1,1);
|
||||
insert into test values(1,2);
|
||||
insert into test values(1,3);
|
||||
insert into test values(1,4);
|
||||
select * from test;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from test;
|
||||
desc select * from test;
|
||||
describe select * from test;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain insert into test values(1,5);
|
||||
desc insert into test values(1,5);
|
||||
describe insert into test values(1,5);
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain insert into test values(1,4);
|
||||
desc insert into test values(1,4);
|
||||
describe insert into test values(1,4);
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain update test set a=2 where b=2;
|
||||
desc update test set a=2 where b=2;
|
||||
describe update test set a=2 where b=2;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain update test set b=2 where a=1;
|
||||
desc update test set b=2 where a=1;
|
||||
describe update test set b=2 where a=1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain delete from test where b=5;
|
||||
desc delete from test where b=5;
|
||||
describe delete from test where b=5;
|
||||
--enable_result_log
|
||||
--error 1064
|
||||
explain create table test(a int,b int primary key);
|
||||
--error 1064
|
||||
desc create table test(a int,b int primary key);
|
||||
--error 1064
|
||||
describe create table test(a int,b int primary key);
|
||||
--error 1064
|
||||
explain drop table test;
|
||||
--error 1064
|
||||
desc drop table test;
|
||||
--error 1064
|
||||
describe drop table test;
|
||||
--enable_result_log
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists sd;
|
||||
--enable_warnings
|
||||
create table sd(a int);
|
||||
insert into sd values(5),(4),(4),(3),(2),(2),(2),(1);
|
||||
--disable_result_log
|
||||
explain select @rownum := @rownum + 1 as row, @rank := IF(@prev_score!=a, @rownum, @rank) as rank, @prev_score := a as score from sd;
|
||||
--enable_result_log
|
||||
|
||||
## test for cast mod for explain: bug#8454097
|
||||
explain outline select 1 < '2009-12-17 06:03:17';
|
||||
drop table sd;
|
||||
224
tools/deploy/mysql_test/t/fin.test
Normal file
224
tools/deploy/mysql_test/t/fin.test
Normal file
@ -0,0 +1,224 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: ddl
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists fin_influx_extension;
|
||||
drop table if exists fin_influx_inst;
|
||||
drop table if exists fin_settle_serial_map;
|
||||
drop table if exists fin_influx_terminal;
|
||||
drop table if exists fin_info_transaction;
|
||||
drop table if exists fin_influx_terminal_unique;
|
||||
drop table if exists fin_request_no_unique;
|
||||
drop table if exists fin_settle_serial_unique;
|
||||
drop table if exists fin_influx_transaction;
|
||||
drop table if exists idx1_fin_influx_transaction;
|
||||
drop table if exists fin_influx_payer;
|
||||
drop table if exists idx1_fin_influx_payer;
|
||||
drop table if exists idx2_fin_influx_payer;
|
||||
--enable_warnings
|
||||
|
||||
## table 1
|
||||
create table fin_influx_extension(INFLUX_ID varchar(64) primary key, EXTENSION1 varchar(32), EXTENSION2 varchar(32), REQ_EXTENSION varchar(4000), RES_EXTENSION varchar(4000), GMT_CREATE datetime(6), GMT_MODIFIED datetime(6));
|
||||
insert into fin_influx_extension(INFLUX_ID, REQ_EXTENSION, RES_EXTENSION, GMT_CREATE, GMT_MODIFIED) values('0001','req_1', 'res_1', '2012-12-20 12:00', '2013-1-20 13:00');
|
||||
select INFLUX_ID,EXTENSION1,EXTENSION2,REQ_EXTENSION,RES_EXTENSION,GMT_CREATE,GMT_MODIFIED from fin_influx_extension where INFLUX_ID = '0001';
|
||||
|
||||
## table 2
|
||||
create table fin_influx_inst(INFLUX_ID varchar(64) primary key, INST_ID varchar(32), INST_SERIAL_NO varchar(32), INST_REF_NO varchar(32), RESP_AMOUNT int, RESP_CURRENCY char(3), INST_RESULT_CODE varchar(16), INST_RESULT_DESCRIPTION varchar(256), GMT_SETTLE datetime(6), GMT_RESP datetime(6), GMT_CREATE datetime(6), GMT_MODIFIED datetime(6));
|
||||
insert into fin_influx_inst values('0001', '00001', 'serial_no', 'ref_no', 100, '123', 'result_code', 'result_des', '2013-1-20 13:00','2013-1-20 13:00','2013-1-20 13:00','2013-1-20 13:00');
|
||||
|
||||
SELECT INFLUX_ID, INST_ID, INST_SERIAL_NO, INST_REF_NO, RESP_AMOUNT, RESP_CURRENCY, INST_RESULT_CODE, INST_RESULT_DESCRIPTION, GMT_SETTLE, GMT_RESP, GMT_CREATE, GMT_MODIFIED FROM fin_influx_inst WHERE INFLUX_ID = '0001';
|
||||
|
||||
## table 3 fin_settle_serial_map
|
||||
create table fin_settle_serial_map(INFLUX_ID varchar(64) primary key, SETTLE_SERIAL_NO varchar(64), INST_ID varchar(32), FINANCE_EXCHANGE_CODE varchar(32), GMT_CREATE datetime(6), GMT_MODIFIED datetime(6));
|
||||
SELECT FINANCE_EXCHANGE_CODE, SETTLE_SERIAL_NO, INST_ID, INFLUX_ID, GMT_CREATE, GMT_MODIFIED FROM fin_settle_serial_map WHERE SETTLE_SERIAL_NO = '0001' AND FINANCE_EXCHANGE_CODE = '0001';
|
||||
SELECT FINANCE_EXCHANGE_CODE, SETTLE_SERIAL_NO, INST_ID, INFLUX_ID, GMT_CREATE, GMT_MODIFIED FROM fin_settle_serial_map WHERE SETTLE_SERIAL_NO = '0001';
|
||||
SELECT INFLUX_ID FROM fin_settle_serial_map WHERE FINANCE_EXCHANGE_CODE IN ('EXCHANGECODES') AND SETTLE_SERIAL_NO = '0001';
|
||||
|
||||
## table 4 fin_influx_terminal
|
||||
create table fin_influx_terminal(influx_id varchar(64) primary key, inst_id varchar(32), inst_merchant_no varchar(32), inst_terminal_no varchar(32), term_batch_no varchar(6), term_trace_no varchar(6), rrn varchar(12), auth_code varchar(6), gmt_create datetime, gmt_modified datetime, finance_exchange_code varchar(32), inst_account_no varchar(32), exchange_amount int, exchange_currency char(3), extension varchar(4000));
|
||||
select influx_id, inst_id, inst_merchant_no, inst_terminal_no, term_batch_no, term_trace_no, rrn, auth_code, gmt_create, gmt_modified, finance_exchange_code, inst_account_no, exchange_amount, exchange_currency, extension from fin_influx_terminal where influx_id='0001' and term_trace_no = '123';
|
||||
|
||||
## table 5 fin_info_transaction
|
||||
create table fin_info_transaction(
|
||||
info_id varchar(64) primary key,
|
||||
inst_id varchar(32),
|
||||
business_code varchar(16),
|
||||
sub_business_code varchar(16),
|
||||
exchange_type varchar(32),
|
||||
finance_exchange_code varchar(32),
|
||||
exchange_status varchar(8),
|
||||
request_info varchar(4000),
|
||||
response_info varchar(4000),
|
||||
gmt_send datetime,
|
||||
gmt_res datetime,
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime,
|
||||
result_code varchar(16),
|
||||
result_description varchar(256),
|
||||
inst_result_code varchar(16),
|
||||
inst_result_description varchar(256)
|
||||
);
|
||||
# select using primary key
|
||||
|
||||
## table 6 fin_influx_terminal_unique
|
||||
create table fin_influx_terminal_unique(
|
||||
inst_id varchar(32),
|
||||
inst_merchant_no varchar(32),
|
||||
inst_terminal_no varchar(32),
|
||||
term_batch_no varchar(6),
|
||||
term_trace_no varchar(6),
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime,
|
||||
primary key(inst_id, term_batch_no, inst_merchant_no, term_trace_no, inst_terminal_no)
|
||||
);
|
||||
#selects to add
|
||||
|
||||
|
||||
## table 7 fin_request_no_unique
|
||||
create table fin_request_no_unique(
|
||||
request_identify varchar(32),
|
||||
request_biz_no varchar(64),
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime,
|
||||
influx_id varchar(64),
|
||||
primary key(request_identify, request_biz_no)
|
||||
);
|
||||
# selects to add
|
||||
|
||||
|
||||
## table 8 fin_settle_serial_unique
|
||||
create table fin_settle_serial_unique(
|
||||
finance_exchange_code varchar(32),
|
||||
settle_serial_no varchar(64),
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime,
|
||||
primary key(finance_exchange_code, settle_serial_no)
|
||||
);
|
||||
|
||||
## table 9 fin_influx_transaction
|
||||
create table fin_influx_transaction(
|
||||
influx_id varchar(64) primary key,
|
||||
org_influx_id varchar(64),
|
||||
inst_id varchar(32),
|
||||
business_code varchar(16),
|
||||
sub_business_code varchar(16),
|
||||
exchange_type varchar(32),
|
||||
finance_exchange_code varchar(32),
|
||||
settle_serial_no varchar(64),
|
||||
payer_account_no varchar(32),
|
||||
exchange_amount int,
|
||||
exchange_currency char(3),
|
||||
account_amount int,
|
||||
account_currency char(3),
|
||||
settle_amount int,
|
||||
settle_currency char(3),
|
||||
settle_status varchar(8),
|
||||
exchange_status varchar(8),
|
||||
result_code varchar(16),
|
||||
result_description varchar(256),
|
||||
recover_flag char(1),
|
||||
recon_flag char(1),
|
||||
negative_flag char(1),
|
||||
negative_exchange_type varchar(16),
|
||||
request_identify varchar(32),
|
||||
request_biz_no varchar(64),
|
||||
pay_unique_no varchar(64),
|
||||
pay_channel_api varchar(32),
|
||||
inst_channel_api varchar(32),
|
||||
clear_channel varchar(32),
|
||||
biz_identity varchar(32),
|
||||
gmt_submit datetime,
|
||||
gmt_resp datetime,
|
||||
gmt_settle datetime,
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime
|
||||
);
|
||||
select influx_id, org_influx_id, inst_id, business_code, sub_business_code, exchange_type, finance_exchange_code, settle_serial_no, payer_account_no, exchange_amount, exchange_currency, account_amount, account_currency, settle_amount, settle_currency, settle_status, exchange_status, result_code, result_description, recover_flag, recon_flag, negative_flag, negative_exchange_type, request_identify, request_biz_no, pay_unique_no, pay_channel_api, inst_channel_api, clear_channel, biz_identity, gmt_submit, gmt_resp, gmt_settle, gmt_create, gmt_modified from fin_influx_transaction where influx_id = '0001';
|
||||
|
||||
select influx_id, org_influx_id, inst_id, business_code, sub_business_code, exchange_type, finance_exchange_code, settle_serial_no, payer_account_no, exchange_amount, exchange_currency, account_amount, account_currency, settle_amount, settle_currency, settle_status, exchange_status, result_code, result_description, recover_flag, recon_flag, negative_flag, negative_exchange_type, request_identify, request_biz_no, pay_unique_no, pay_channel_api, inst_channel_api, clear_channel, biz_identity, gmt_submit, gmt_resp, gmt_settle, gmt_create, gmt_modified from fin_influx_transaction where finance_exchange_code = 'ss' and settle_serial_no = '00001';
|
||||
|
||||
select influx_id, org_influx_id, inst_id, business_code, sub_business_code, exchange_type, finance_exchange_code, settle_serial_no, payer_account_no, exchange_amount, exchange_currency, account_amount, account_currency, settle_amount, settle_currency, settle_status, exchange_status, result_code, result_description, recover_flag, recon_flag, negative_flag, negative_exchange_type, request_identify, request_biz_no, pay_unique_no, pay_channel_api, inst_channel_api, clear_channel, biz_identity, gmt_submit, gmt_resp, gmt_settle, gmt_create, gmt_modified from fin_influx_transaction where inst_channel_api = 'api' and settle_serial_no = '00001';
|
||||
|
||||
### table 10 idx1_fin_influx_transaction
|
||||
|
||||
create table idx1_fin_influx_transaction(
|
||||
settle_serial_no varchar(64),
|
||||
finance_exchange_code varchar(32),
|
||||
influx_id varchar(64),
|
||||
inst_channel_api varchar(32),
|
||||
primary key(settle_serial_no,finance_exchange_code,influx_id)
|
||||
);
|
||||
|
||||
select * from idx1_fin_influx_transaction where finance_exchange_code = 'sss' and settle_serial_no = 'ss';
|
||||
select * from idx1_fin_influx_transaction where inst_channel_api = 'ss' and settle_serial_no = 'ss';
|
||||
|
||||
### table 11 fin_influx_payer
|
||||
|
||||
create table fin_influx_payer(
|
||||
|
||||
influx_id varchar(64) ,
|
||||
payer_account_no varchar(32),
|
||||
payer_name varchar(32),
|
||||
inst_account_no varchar(32),
|
||||
inst_account_name varchar(128),
|
||||
|
||||
card_type varchar(16),
|
||||
card_index varchar(32),
|
||||
issuer varchar(32),
|
||||
agreement_no varchar(100),
|
||||
certificate_type varchar(64),
|
||||
certificate_no varchar(32),
|
||||
mobile_phone varchar(16),
|
||||
pay_tool varchar(16),
|
||||
bill_no varchar(32),
|
||||
bill_type varchar(8),
|
||||
gmt_create datetime,
|
||||
gmt_modified datetime,
|
||||
primary key(inst_account_no, gmt_create, influx_id)
|
||||
);
|
||||
select influx_id, payer_account_no, payer_name, inst_account_no, inst_account_name, card_type, card_index, issuer, agreement_no, certificate_type, certificate_no, mobile_phone, pay_tool, bill_no, bill_type, gmt_create, gmt_modified from fin_influx_payer where influx_id='0001';
|
||||
|
||||
select influx_id, payer_account_no, payer_name, inst_account_no, inst_account_name, card_type, card_index, issuer, agreement_no, certificate_type, certificate_no, mobile_phone, pay_tool, bill_no, bill_type, gmt_create, gmt_modified from fin_influx_payer where bill_no='sss';
|
||||
|
||||
select influx_id, payer_account_no, payer_name, inst_account_no, inst_account_name, card_type, card_index, issuer, agreement_no, certificate_type, certificate_no, mobile_phone, pay_tool, bill_no, bill_type, gmt_create, gmt_modified from fin_influx_payer where inst_account_no='0001' and gmt_create>='2012-10-1 23:00:00' and gmt_create<='2012-12-23 23:00:00';
|
||||
|
||||
## table 12 idx1_fin_influx_payer
|
||||
create table idx1_fin_influx_payer (
|
||||
bill_no varchar(32),
|
||||
inst_account_no varchar(32),
|
||||
gmt_create datetime,
|
||||
influx_id varchar(64),
|
||||
virtual_col1 int,
|
||||
primary key(bill_no,inst_account_no,gmt_create,influx_id)
|
||||
);
|
||||
# bill_no+inst_account_no+gmt_create+influx_id+influx_id
|
||||
|
||||
## table 13 idx2_fin_influx_payer
|
||||
create table idx2_fin_influx_payer(
|
||||
influx_id varchar(64),
|
||||
inst_account_no varchar(32),
|
||||
gmt_create datetime,
|
||||
virtual_col1 int,
|
||||
a int,
|
||||
primary key(influx_id,inst_account_no,gmt_create,virtual_col1)
|
||||
);
|
||||
# influx_id+inst_account_no+gmt_create+inlux_id主键 ,满足fin_influx_payer的第3种where influx_id=?查询
|
||||
|
||||
drop table fin_influx_extension;
|
||||
drop table fin_influx_inst;
|
||||
drop table fin_settle_serial_map;
|
||||
drop table fin_influx_terminal;
|
||||
drop table fin_info_transaction;
|
||||
drop table fin_influx_terminal_unique;
|
||||
drop table fin_request_no_unique;
|
||||
drop table fin_settle_serial_unique;
|
||||
drop table fin_influx_transaction;
|
||||
drop table idx1_fin_influx_transaction;
|
||||
drop table fin_influx_payer;
|
||||
drop table idx1_fin_influx_payer;
|
||||
drop table idx2_fin_influx_payer;
|
||||
286
tools/deploy/mysql_test/t/func_group_1.test
Normal file
286
tools/deploy/mysql_test/t/func_group_1.test
Normal file
@ -0,0 +1,286 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
#tags: optimizer, group_by
|
||||
#description:
|
||||
|
||||
--enable_abort_on_error
|
||||
## simple test of all group functions
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
#
|
||||
##set @sav_dpi= @@div_precision_increment;
|
||||
##set div_precision_increment= 5;
|
||||
##show variables like 'div_precision_increment';
|
||||
##create table t1 (grp int, a bigint unsigned, c char(10) not null);
|
||||
#--real_sleep 1
|
||||
create table t1 (pk int primary key, grp int, a int, c char(10) not null);
|
||||
#--real_sleep 1
|
||||
|
||||
insert into t1 values (1, 1,1,'a');
|
||||
insert into t1 values (2, 2,2,'b');
|
||||
insert into t1 values (3, 2,3,'c');
|
||||
insert into t1 values (4, 3,4,'E');
|
||||
insert into t1 values (5, 3,5,'C');
|
||||
insert into t1 values (6, 3,6,'D');
|
||||
#
|
||||
## Test of MySQL field extension with and without matching records.
|
||||
##### Note: The two following statements may fail if the execution plan
|
||||
##### or optimizer is changed. The result for column c is undefined.
|
||||
select a,c,sum(a) from t1 group by a order by a;
|
||||
select a,c,sum(a) from t1 where a > 10 group by a order by a;
|
||||
select sum(a) from t1 where a > 10;
|
||||
#select a from t1 order by rand(10);
|
||||
#select distinct a from t1 order by rand(10);
|
||||
select count(distinct a),count(distinct grp) from t1;
|
||||
insert into t1 values (7, null,null,'');
|
||||
select count(distinct a),count(distinct grp) from t1;
|
||||
#
|
||||
#select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
|
||||
#select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
|
||||
#--disable_warnings
|
||||
#select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
|
||||
#--enable_warnings
|
||||
#
|
||||
#--real_sleep 1
|
||||
create table t2 (pk int primary key, grp int, a int, c char(10));
|
||||
#--real_sleep 1
|
||||
#insert into t2
|
||||
select grp,max(a)+max(grp),max(c) from t1 group by grp order by grp;
|
||||
#
|
||||
## REPLACE ... SELECT doesn't yet work with PS
|
||||
#replace into t2 select grp, a, c from t1 limit 2,1;
|
||||
select * from t2;
|
||||
#
|
||||
drop table t1,t2;
|
||||
#
|
||||
##
|
||||
## Problem with std()
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (id int ,value1 decimal(10,2),c int primary key);
|
||||
INSERT INTO t1 VALUES (1,0.00,1),(1,1.00,2), (1,2.00,3), (2,10.00,4), (2,11.00,5), (2,12.00,6);
|
||||
CREATE TABLE t2 (id int primary key,name char(20));
|
||||
INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
|
||||
#select id, avg(value1), std(value1), variance(value1) from t1 group by id;
|
||||
--sorted_result
|
||||
select id, avg(value1) from t1 group by id;
|
||||
#select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id;
|
||||
--sorted_result
|
||||
select name, avg(value1) from t1, t2 where t1.id = t2.id group by t1.id;
|
||||
drop table t1,t2;
|
||||
#
|
||||
##
|
||||
## Test of bug in left join & avg
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
create table t1 (pk int primary key, id int not null);
|
||||
#--real_sleep 1
|
||||
create table t2 (pk int primary key, id int not null,rating int null);
|
||||
#--real_sleep 1
|
||||
insert into t1 values(1,1),(2,2),(3,3);
|
||||
insert into t2 values(1, 1, 3),(2, 2, NULL),(3, 2, NULL),(4, 3, 2),(5, 3, NULL);
|
||||
select t1.id, avg(rating) from t1 left join t2 on ( t1.id = t2.id ) group by t1.id order by t1.id;
|
||||
## Test different types with avg()
|
||||
#select sql_small_result t2.id, avg(rating) from t2 group by t2.id;
|
||||
#select sql_big_result t2.id, avg(rating) from t2 group by t2.id;
|
||||
#select sql_small_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
|
||||
#select sql_big_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
|
||||
drop table t1,t2;
|
||||
#
|
||||
##
|
||||
## test of count
|
||||
##
|
||||
#--real_sleep 1
|
||||
create table t1 (a int primary key, c char(10), b char(128));
|
||||
#--real_sleep 1
|
||||
INSERT INTO t1 VALUES (1,'1','1');
|
||||
INSERT INTO t1 VALUES (2,'2','2');
|
||||
INSERT INTO t1 VALUES (4,'4','4');
|
||||
#
|
||||
select count(*) from t1;
|
||||
select count(*) from t1 where a = 1;
|
||||
select count(*) from t1 where a = 100;
|
||||
select count(*) from t1 where a >= 10;
|
||||
select count(a) from t1 where a = 1;
|
||||
select count(a) from t1 where a = 100;
|
||||
select count(a) from t1 where a >= 10;
|
||||
select count(b) from t1 where b >= 2;
|
||||
select count(b) from t1 where b >= 10;
|
||||
select count(c) from t1 where c = 10;
|
||||
drop table t1;
|
||||
#
|
||||
##
|
||||
## Test of bug in COUNT(i)*(i+0)
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
CREATE TABLE t1 (d datetime default now(), i int primary key);
|
||||
#--real_sleep 1
|
||||
INSERT INTO t1(i) VALUES (1);
|
||||
--sorted_result
|
||||
SELECT COUNT(i), i, COUNT(i)*i FROM t1 GROUP BY i;
|
||||
--sorted_result
|
||||
SELECT COUNT(i), (i+0), COUNT(i)*(i+0) FROM t1 GROUP BY i;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Another SUM() problem with 3.23.2
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
create table t1 (
|
||||
pk int primary key,
|
||||
num float,
|
||||
my_user char(20)
|
||||
);
|
||||
#--real_sleep 1
|
||||
# remeber to remove comments
|
||||
insert into t1 values (1, 10.3,'nem'),(2, 20.53,'monty'),(3, 30.23,'sinisa');
|
||||
insert into t1 values (4, 30.13,'nem'),(5, 20.98,'monty'),(6, 10.45,'sinisa');
|
||||
insert into t1 values (7, 5.2,'nem'),(8, 8.64,'monty'),(9, 11.12,'sinisa');
|
||||
select sum(num) from t1;
|
||||
select sum(num) from t1 group by my_user order by my_user;
|
||||
drop table t1;
|
||||
#
|
||||
##
|
||||
## Test problem with MIN() optimization in case of null values
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
--enable_warnings
|
||||
create table t1 (pk int primary key, a1 int, a2 char(3));
|
||||
#--real_sleep 1
|
||||
insert into t1 values(1, 10,'aaa'), (2, 10,null), (3, 10,'bbb'), (4, 20,'zzz');
|
||||
#--real_sleep 1
|
||||
create table t2(pk int primary key, a1 char(3), a2 int, a3 float);
|
||||
create table t3(pk int primary key, a1 char(3), a2 int, a3 float);
|
||||
#--real_sleep 1
|
||||
select * from t1;
|
||||
## The following returned NULL in 4.0.10
|
||||
select min(a2) from t1;
|
||||
|
||||
select max(t1.a1), max(t2.a2) from t1, t2;
|
||||
#select max(t1.a1) from t1, t2;
|
||||
#select max(t2.a2), max(t1.a1) from t1, t2;
|
||||
|
||||
#
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
#explain select min(a2) from t1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
#explain select max(t1.a1), max(t2.a2) from t1, t2;
|
||||
--enable_result_log
|
||||
#
|
||||
insert into t2 values(1, 'AAA', 10, 0.5);
|
||||
insert into t2 values(2, 'BBB', 20, 1.0);
|
||||
#select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
|
||||
#
|
||||
#select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
|
||||
#select max(t2.a1), max(t1.a1) from t1, t2 where t2.a2=9;
|
||||
#there is a bug
|
||||
--error 1054
|
||||
select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t3 on t1.a1=10;
|
||||
select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
|
||||
#select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=20;
|
||||
#select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=10;
|
||||
select max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and 1=0 where t2.a1='AAA';
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and 1=0 where t2.a1='AAA';
|
||||
--enable_result_log
|
||||
select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 where t2.a1='AAA';
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 where t2.a1='AAA';
|
||||
--enable_result_log
|
||||
select max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk where t2.a1='AAA' and 1=0;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk where t2.a1='AAA' and 1=0;
|
||||
--enable_result_log
|
||||
select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and t1.a1=10;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and t1.a1=10;
|
||||
--enable_result_log
|
||||
select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and t1.pk=10;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.pk=t2.pk and t1.pk=10;
|
||||
--enable_result_log
|
||||
select * from t1 left join t2 on t1.pk=t2.pk where t2.a2 > 1 and t2.a2 < 10;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from t1 left join t2 on t1.pk=t2.pk where t2.a2 > 1 and t2.a2 < 10;
|
||||
--enable_result_log
|
||||
select * from t1 left join t2 on t1.pk=t2.pk and t2.a2 > 1 and t2.a2 < 10 order by t1.pk;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from t1 left join t2 on t1.pk=t2.pk and t2.a2 > 1 and t2.a2 < 10;
|
||||
--enable_result_log
|
||||
|
||||
drop table t1,t2;
|
||||
#
|
||||
##
|
||||
## Test of group function and NULL values
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
CREATE TABLE t1 (pk int primary key, a int, b int);
|
||||
#--real_sleep 1
|
||||
#select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
select count(b), sum(b), avg(b), min(b), max(b) from t1;
|
||||
select a,count(b), sum(b), avg(b), min(b), max(b) from t1 group by a order by a;
|
||||
insert into t1 values (1, 1,null);
|
||||
select a,count(b), sum(b), avg(b), min(b), max(b) from t1 group by a order by a;
|
||||
insert into t1 values (2, 1,null);
|
||||
insert into t1 values (3, 2,null);
|
||||
select a,count(b), sum(b), avg(b), min(b), max(b) from t1 group by a order by a;
|
||||
#select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (4, 2,1);
|
||||
select a,count(b), sum(b), avg(b), min(b), max(b) from t1 group by a order by a;
|
||||
#select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (5, 3,1);
|
||||
select a,count(b), sum(b), avg(b), min(b), max(b) from t1 group by a order by a;
|
||||
#select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
#explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
--enable_result_log
|
||||
drop table t1;
|
||||
#
|
||||
##
|
||||
## Bug #1972: test for bit_and(), bit_or() and negative values
|
||||
##
|
||||
#--real_sleep 1
|
||||
create table t1 (col int primary key,col2 int);
|
||||
#--real_sleep 1
|
||||
insert into t1(col) values (-1), (-2), (-3);
|
||||
#select bit_and(col), bit_or(col) from t1;
|
||||
#select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
drop table t1;
|
||||
#
|
||||
##
|
||||
## Bug #3376: avg() and an empty table
|
||||
##
|
||||
#
|
||||
#--real_sleep 1
|
||||
create table t1 (a int primary key,b int);
|
||||
#--real_sleep 1
|
||||
select avg(2) from t1;
|
||||
drop table t1;
|
||||
#
|
||||
46
tools/deploy/mysql_test/t/func_group_5.test
Normal file
46
tools/deploy/mysql_test/t/func_group_5.test
Normal file
@ -0,0 +1,46 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: jiangxiu.wt
|
||||
#owner group: sql1
|
||||
|
||||
## simple test of all group functions
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
##
|
||||
## BUG#3190, WL#1639: Standard Deviation STDDEV - 2 different calculations
|
||||
##
|
||||
#
|
||||
#CREATE TABLE t1 (id int(11),value1 float(10,2));
|
||||
#INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00), (2,13.00);
|
||||
#select id, stddev_pop(value1), var_pop(value1), stddev_samp(value1), var_samp(value1) from t1 group by id;
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## BUG#8464 decimal AVG returns incorrect result
|
||||
##
|
||||
|
||||
CREATE TABLE t1 (pk int primary key,col1 double , col2 double);
|
||||
INSERT INTO t1(pk,col1) VALUES (1,-5.00000000001),(2,-5.00000000002),(3,-5.00000000003),(4,-5.00000000000);
|
||||
#insert into t1 select * from t1;
|
||||
select col1,count(col1),sum(col1),avg(col1) from t1 group by col1 order by col1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## BUG#8465 decimal MIN and MAX return incorrect result
|
||||
##
|
||||
#
|
||||
create table t1 (pk int primary key,col1 double , col2 double);
|
||||
insert into t1(pk,col1) values (1,-5.00000000001);
|
||||
insert into t1(pk,col1) values (2,-5.00000000002);
|
||||
select col1,sum(col1),max(col1),min(col1) from t1 group by col1 order by col1;
|
||||
#delete from t1;
|
||||
insert into t1(pk,col1) values (3,5.00000000003);
|
||||
insert into t1(pk,col1) values (4,5.00000000004);
|
||||
select col1,sum(col1),max(col1),min(col1) from t1 group by col1 order by col1;
|
||||
DROP TABLE t1;
|
||||
48
tools/deploy/mysql_test/t/func_group_6.test
Normal file
48
tools/deploy/mysql_test/t/func_group_6.test
Normal file
@ -0,0 +1,48 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: bin.lb
|
||||
#owner group: sql1
|
||||
#tags: group_by
|
||||
#description:
|
||||
|
||||
##
|
||||
## simple test of all group functions
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
##
|
||||
## Test that new VARCHAR correctly works with COUNT(DISTINCT)
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1 (pk int primary key, a VARCHAR(400));
|
||||
INSERT INTO t1 VALUES (1,'A'), (2,'a'), (3,'a '), (4,'a '),
|
||||
(5,'B'), (6,'b'), (7,'b '), (8,'b ');
|
||||
SELECT COUNT(DISTINCT a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Test for buf #9210: GROUP BY with expression if a decimal type
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1 (pk int primary key, a int, b int, c int);
|
||||
INSERT INTO t1 (pk, a, b, c) VALUES
|
||||
(1,1,1,1), (2,1,1,2), (3,1,1,3),
|
||||
(4,1,2,1), (5,1,2,2), (6,1,2,3),
|
||||
(7,1,3,1), (8,1,3,2), (9,1,3,3),
|
||||
(10,2,1,1), (11,2,1,2), (12,2,1,3),
|
||||
(13,2,2,1), (14,2,2,2), (15,2,2,3),
|
||||
(16,2,3,1), (17,2,3,2), (18,2,3,3),
|
||||
(19,3,1,1), (20,3,1,2), (21,3,1,3),
|
||||
(22,3,2,1), (23,3,2,2), (24,3,2,3),
|
||||
(25,3,3,1), (26,3,3,2), (27,3,3,3);
|
||||
#
|
||||
SELECT b/c as v, a FROM t1 ORDER BY v, a;
|
||||
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v ORDER BY v;
|
||||
SELECT SUM(a) as suma FROM t1 GROUP BY b/c ORDER BY suma;
|
||||
|
||||
DROP TABLE t1;
|
||||
490
tools/deploy/mysql_test/t/func_group_7.test
Normal file
490
tools/deploy/mysql_test/t/func_group_7.test
Normal file
@ -0,0 +1,490 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: jiangxiu.wt
|
||||
#owner group: sql1
|
||||
|
||||
##
|
||||
## simple test of all group functions
|
||||
##
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
##
|
||||
## Bug #10966: Variance functions return wrong data type
|
||||
##
|
||||
#
|
||||
#create table t1 select variance(0);
|
||||
#show create table t1;
|
||||
#drop table t1;
|
||||
#create table t1 select stddev(0);
|
||||
#show create table t1;
|
||||
#drop table t1;
|
||||
#
|
||||
#
|
||||
##
|
||||
## Bug#22555: STDDEV yields positive result for groups with only one row
|
||||
##
|
||||
#
|
||||
#create table bug22555 (i smallint primary key auto_increment, s1 smallint, s2 smallint, e decimal(30,10), o double);
|
||||
#insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571);
|
||||
#select std(s1/s2) from bug22555 group by i;
|
||||
#select std(e) from bug22555 group by i;
|
||||
#select std(o) from bug22555 group by i;
|
||||
#drop table bug22555;
|
||||
#
|
||||
#create table bug22555 (i smallint, s1 smallint, s2 smallint, o1 double, o2 double, e1 decimal, e2 decimal);
|
||||
#insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
|
||||
#select i, count(*) from bug22555 group by i;
|
||||
#select std(s1/s2) from bug22555 where i=1;
|
||||
#select std(s1/s2) from bug22555 where i=2;
|
||||
#select std(s1/s2) from bug22555 where i=3;
|
||||
#select std(s1/s2) from bug22555 where i=1 group by i;
|
||||
#select std(s1/s2) from bug22555 where i=2 group by i;
|
||||
#select std(s1/s2) from bug22555 where i=3 group by i;
|
||||
#select std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(o1/o2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#set @saved_div_precision_increment=@@div_precision_increment;
|
||||
#set div_precision_increment=19;
|
||||
#select i, count(*), variance(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), variance(o1/o2) from bug22555 group by i order by i;
|
||||
#select i, count(*), variance(e1/e2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(o1/o2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#set div_precision_increment=20;
|
||||
#select i, count(*), variance(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), variance(o1/o2) from bug22555 group by i order by i;
|
||||
#select i, count(*), variance(e1/e2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(o1/o2) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#set @@div_precision_increment=@saved_div_precision_increment;
|
||||
#insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
|
||||
#insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
|
||||
#insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
|
||||
#
|
||||
#select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#select std(s1/s2) from bug22555;
|
||||
#select std(o1/o2) from bug22555;
|
||||
#select std(e1/e2) from bug22555;
|
||||
#set @saved_div_precision_increment=@@div_precision_increment;
|
||||
#set div_precision_increment=19;
|
||||
#select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#select round(std(s1/s2), 17) from bug22555;
|
||||
#select std(o1/o2) from bug22555;
|
||||
#select round(std(e1/e2), 17) from bug22555;
|
||||
#set div_precision_increment=20;
|
||||
#select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
#select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
|
||||
#select i, count(*), std(e1/e2) from bug22555 group by i order by i;
|
||||
#select round(std(s1/s2), 17) from bug22555;
|
||||
#select std(o1/o2) from bug22555;
|
||||
#select round(std(e1/e2), 17) from bug22555;
|
||||
#set @@div_precision_increment=@saved_div_precision_increment;
|
||||
#drop table bug22555;
|
||||
#
|
||||
#create table bug22555 (s smallint, o double, e decimal);
|
||||
#insert into bug22555 values (1,1,1),(2,2,2),(3,3,3),(6,6,6),(7,7,7);
|
||||
#select var_samp(s), var_pop(s) from bug22555;
|
||||
#select var_samp(o), var_pop(o) from bug22555;
|
||||
#select var_samp(e), var_pop(e) from bug22555;
|
||||
#drop table bug22555;
|
||||
#
|
||||
#create table bug22555 (s smallint, o double, e decimal);
|
||||
#insert into bug22555 values (null,null,null),(null,null,null);
|
||||
#select var_samp(s) as 'null', var_pop(s) as 'null' from bug22555;
|
||||
#select var_samp(o) as 'null', var_pop(o) as 'null' from bug22555;
|
||||
#select var_samp(e) as 'null', var_pop(e) as 'null' from bug22555;
|
||||
#insert into bug22555 values (1,1,1);
|
||||
#select var_samp(s) as 'null', var_pop(s) as '0' from bug22555;
|
||||
#select var_samp(o) as 'null', var_pop(o) as '0' from bug22555;
|
||||
#select var_samp(e) as 'null', var_pop(e) as '0' from bug22555;
|
||||
#insert into bug22555 values (2,2,2);
|
||||
#select var_samp(s) as '0.5', var_pop(s) as '0.25' from bug22555;
|
||||
#select var_samp(o) as '0.5', var_pop(o) as '0.25' from bug22555;
|
||||
#select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
|
||||
#drop table bug22555;
|
||||
#
|
||||
#
|
||||
##
|
||||
## Bug #21976: Unnecessary warning with count(decimal)
|
||||
##
|
||||
|
||||
create table t1 (pk int primary key,a double ,b double);
|
||||
insert into t1(pk,a) values (1,12345678901234567890);
|
||||
select count(a) from t1;
|
||||
select count(distinct a) from t1;
|
||||
drop table t1;
|
||||
#
|
||||
##
|
||||
## Bug #23184: SELECT causes server crash
|
||||
##
|
||||
CREATE TABLE t1 (a INT, b INT primary key);
|
||||
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
|
||||
#INSERT INTO t1 SELECT a, b+8 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+16 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+32 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+64 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+128 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+256 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+512 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+1024 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+2048 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+4096 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+8192 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+16384 FROM t1;
|
||||
#INSERT INTO t1 SELECT a, b+32768 FROM t1;
|
||||
SELECT a,COUNT(DISTINCT b) AS cnt FROM t1 GROUP BY a HAVING cnt > 50;
|
||||
SELECT a,SUM(DISTINCT b) AS sumation FROM t1 GROUP BY a HAVING sumation > 50;
|
||||
SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
|
||||
#
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Bug #27573: MIN() on an indexed column which is always NULL sets _other_
|
||||
## results to NULL
|
||||
##
|
||||
CREATE TABLE t1 ( a INT, b INT primary key);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
EXPLAIN SELECT MIN(a), MIN(b) FROM t1;
|
||||
--enable_result_log
|
||||
SELECT MIN(a), MIN(b) FROM t1;
|
||||
#
|
||||
CREATE TABLE t2( pk int primary key, a INT, b INT, c INT);
|
||||
INSERT INTO t2 ( pk,a, b, c ) VALUES ( 1,1, NULL, 2 ), ( 2,1, 3, 4 ), ( 3,1, 4, 4 );
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
|
||||
--enable_result_log
|
||||
SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
|
||||
#
|
||||
CREATE TABLE t3 (pk int primary key , a INT, b INT, c int);
|
||||
INSERT INTO t3 VALUES (1,1, NULL, 1), (2,2, NULL, 2), (3,3, NULL, 3);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2;
|
||||
--enable_result_log
|
||||
SELECT MIN(a), MIN(b) FROM t3 where a = 2;
|
||||
#
|
||||
CREATE TABLE t4 (a INT, b INT, c int, primary KEY(a, c));
|
||||
INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (3, 1, 3);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2;
|
||||
--enable_result_log
|
||||
SELECT MIN(a), MIN(b) FROM t4 where a = 2;
|
||||
SELECT MIN(b), min(c) FROM t4 where a = 2;
|
||||
#
|
||||
CREATE TABLE t5( a INT, b INT, primary KEY( a, b),c int);
|
||||
INSERT INTO t5(a,b) VALUES( 1, 1 ), ( 1, 2 );
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
|
||||
--enable_result_log
|
||||
SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
|
||||
SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1;
|
||||
#
|
||||
DROP TABLE t1, t2, t3, t4, t5;
|
||||
#DROP TABLE t1, t2;
|
||||
#DROP TABLE t3;
|
||||
#drop table t4, t5;
|
||||
#
|
||||
##
|
||||
## Bug #31156: mysqld: item_sum.cc:918:
|
||||
## virtual bool Item_sum_distinct::setup(THD*): Assertion
|
||||
##
|
||||
#
|
||||
#CREATE TABLE t1 (a INT);
|
||||
#INSERT INTO t1 values (),(),();
|
||||
#SELECT (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ) as x FROM t1
|
||||
# GROUP BY x;
|
||||
#SELECT 1 FROM t1 GROUP BY (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) );
|
||||
#
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Bug #30715: Assertion failed: item_field->field->real_maybe_null(), file
|
||||
## .\opt_sum.cc, line
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1 (a int, b datetime(6), primary key (a,b),c int);
|
||||
SELECT MIN(b) FROM t1 WHERE a=1 AND b>'2007-08-01';
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Bug #31794: no syntax error on SELECT id FROM t HAVING count(*)>2;
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1 (a INT primary key, b int);
|
||||
INSERT INTO t1(a) VALUES (1),(2),(3),(4);
|
||||
#
|
||||
#SET SQL_MODE=ONLY_FULL_GROUP_BY;
|
||||
#--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
SELECT a FROM t1 HAVING COUNT(*)>2;
|
||||
#--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
SELECT COUNT(*), a FROM t1;
|
||||
#
|
||||
#SET SQL_MODE=DEFAULT;
|
||||
SELECT a FROM t1 HAVING COUNT(*)>2;
|
||||
SELECT COUNT(*), a FROM t1;
|
||||
#
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Bug #33133: Views are not transparent
|
||||
##
|
||||
#
|
||||
#set SQL_MODE=ONLY_FULL_GROUP_BY;
|
||||
#
|
||||
#CREATE TABLE t1 (a INT);
|
||||
#INSERT INTO t1 VALUES (1),(2),(3),(4);
|
||||
#CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
|
||||
--disable_result_log
|
||||
#EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
|
||||
--enable_result_log
|
||||
#
|
||||
#DROP VIEW v1;
|
||||
#DROP TABLE t1;
|
||||
#SET SQL_MODE=DEFAULT;
|
||||
#
|
||||
##
|
||||
## Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1(pk int primary key,a DOUBLE );
|
||||
INSERT INTO t1 VALUES (1,10), (2,20);
|
||||
SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
#
|
||||
DROP TABLE t1;
|
||||
#
|
||||
##
|
||||
## Bug #39656: Behaviour different for agg functions with & without where -
|
||||
## ONLY_FULL_GROUP_BY
|
||||
##
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT primary key);
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
|
||||
#
|
||||
#SET SQL_MODE='ONLY_FULL_GROUP_BY';
|
||||
#
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t1 where a=1;
|
||||
#
|
||||
#--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
SELECT COUNT(*),a FROM t1;
|
||||
#
|
||||
SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
|
||||
#
|
||||
#--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
|
||||
#SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
|
||||
#FROM t1 outr;
|
||||
#
|
||||
#SELECT COUNT(*) FROM t1 a JOIN t1 outr
|
||||
# ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
|
||||
#
|
||||
#SET SQL_MODE=default;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
#
|
||||
####
|
||||
#--echo End of 5.0 tests
|
||||
#
|
||||
#--echo #
|
||||
#--echo # BUG#47280 - strange results from count(*) with order by multiple
|
||||
#--echo # columns without where/group
|
||||
#--echo #
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Initialize test
|
||||
#--echo #
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL,
|
||||
i INT,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Start test
|
||||
#--echo # All the following queries shall return 1 record
|
||||
#--echo #
|
||||
#
|
||||
#--echo
|
||||
#--echo # Masking all correct values {11...13} for column i in this result.
|
||||
#--replace_column 2 #
|
||||
SELECT MAX(pk) as max, i
|
||||
FROM t1
|
||||
ORDER BY max;
|
||||
#
|
||||
#--echo
|
||||
--disable_result_log
|
||||
#EXPLAIN
|
||||
--enable_result_log
|
||||
#SELECT MAX(pk) as max, i
|
||||
#FROM t1
|
||||
#ORDER BY max;
|
||||
#
|
||||
#--echo
|
||||
#--echo # Only 11 is correct for collumn i in this result
|
||||
SELECT MAX(pk) as max, i
|
||||
FROM t1
|
||||
WHERE pk<2
|
||||
ORDER BY max;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Cleanup
|
||||
#--echo #
|
||||
DROP TABLE t1;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
|
||||
#--echo #
|
||||
#create table t1 (f1 year(2), f2 year(4), f3 datetime(6), f4 datetime(6));
|
||||
#insert into t1 values
|
||||
# (98,1998,19980101,'1998-01-01 00:00:00'),
|
||||
# (00,2000,20000101,'2000-01-01 00:00:01'),
|
||||
# (02,2002,20020101,'2002-01-01 23:59:59'),
|
||||
# (60,2060,20600101,'2060-01-01 11:11:11'),
|
||||
# (70,1970,19700101,'1970-11-11 22:22:22'),
|
||||
# (NULL,NULL,NULL,NULL);
|
||||
#select min(f1),max(f1) from t1;
|
||||
#select min(f2),max(f2) from t1;
|
||||
#select min(f3),max(f3) from t1;
|
||||
#select min(f4),max(f4) from t1;
|
||||
#select a.f1 as a, b.f1 as b, a.f1 > b.f1 as gt,
|
||||
# a.f1 < b.f1 as lt, a.f1<=>b.f1 as eq
|
||||
#from t1 a, t1 b;
|
||||
#select a.f1 as a, b.f2 as b, a.f1 > b.f2 as gt,
|
||||
# a.f1 < b.f2 as lt, a.f1<=>b.f2 as eq
|
||||
#from t1 a, t1 b;
|
||||
#select a.f1 as a, b.f3 as b, a.f1 > b.f3 as gt,
|
||||
# a.f1 < b.f3 as lt, a.f1<=>b.f3 as eq
|
||||
#from t1 a, t1 b;
|
||||
#select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
|
||||
# a.f1 < b.f4 as lt, a.f1<=>b.f4 as eq
|
||||
#from t1 a, t1 b;
|
||||
#select *, f1 = f2 from t1;
|
||||
#drop table t1;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
|
||||
#--echo # MYSQL_TYPE_LONGLONG
|
||||
#--echo #
|
||||
#
|
||||
#CREATE TABLE t1 (a INT);
|
||||
#INSERT INTO t1 VALUES (1), (2);
|
||||
#
|
||||
#SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
|
||||
# ORDER BY t1.a;
|
||||
#
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#58030 crash in Item_func_geometry_from_text::val_str
|
||||
#--echo #
|
||||
#
|
||||
#--disable_result_log
|
||||
#
|
||||
#SELECT MAX(TIMESTAMP(RAND(0)));
|
||||
#SELECT MIN(TIMESTAMP(RAND(0)));
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#58177 crash and valgrind warnings in decimal and protocol sending functions...
|
||||
#--echo #
|
||||
#
|
||||
#SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
|
||||
#SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
|
||||
#SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
|
||||
#SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
|
||||
#SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa');
|
||||
#
|
||||
#--enable_result_log
|
||||
#
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
|
||||
#--echo #
|
||||
#
|
||||
#CREATE TABLE t1 (a BIGINT UNSIGNED);
|
||||
#INSERT INTO t1 VALUES (18446668621106209655);
|
||||
#SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1;
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
|
||||
#--echo #
|
||||
#
|
||||
#CREATE TABLE t1(f1 YEAR(4));
|
||||
#INSERT INTO t1 VALUES (0000),(2001);
|
||||
#--enable_metadata
|
||||
#(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
|
||||
#--disable_metadata
|
||||
#DROP TABLE t1;
|
||||
#
|
||||
#
|
||||
#--echo #
|
||||
#--echo End of 5.1 tests
|
||||
#
|
||||
####
|
||||
#--echo #
|
||||
#--echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
|
||||
#--echo # file .\item_sum.cc, line 587
|
||||
#--echo #
|
||||
#
|
||||
CREATE TABLE t1(a int, primary KEY(a), b int);
|
||||
INSERT INTO t1(a) VALUES (1), (2);
|
||||
SELECT 1 FROM t1 ORDER BY AVG(DISTINCT a);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#55648: Server crash on MIN/MAX on maximum datetime value
|
||||
#--echo #
|
||||
#CREATE TABLE t1(c1 TIME NOT NULL);
|
||||
#INSERT INTO t1 VALUES('837:59:59');
|
||||
#INSERT INTO t1 VALUES('838:59:59');
|
||||
#SELECT MAX(c1) FROM t1;
|
||||
#DROP TABLE t1;
|
||||
#--echo # End of the bug#55648
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#56120: Failed assertion on MIN/MAX on negative datetime value
|
||||
#--echo #
|
||||
#CREATE TABLE t1(c1 TIME NOT NULL);
|
||||
#INSERT INTO t1 VALUES('-00:00:01');
|
||||
#SELECT MAX(c1),MIN(c1) FROM t1;
|
||||
#DROP TABLE t1;
|
||||
#--echo # End of the bug#56120
|
||||
#
|
||||
#--echo #
|
||||
#--echo # Bug#57932 'query with AVG(DISTINCT) returns NULL if last
|
||||
#--echo # aggregated value was NULL'
|
||||
#--echo #
|
||||
CREATE TABLE t1 (pk int primary key,col_int_nokey int);
|
||||
INSERT INTO t1 VALUES (1,7),(2,8),(3,NULL);
|
||||
SELECT AVG(DISTINCT col_int_nokey) FROM t1;
|
||||
# junyue: fix bug http://bugfree.corp.taobao.com/bug/203155
|
||||
SELECT AVG(DISTINCT outr.col_int_nokey) FROM t1 AS outr LEFT JOIN t1 AS outr2 ON
|
||||
outr.col_int_nokey = outr2.col_int_nokey;
|
||||
DROP TABLE t1;
|
||||
#--echo # End of the bug#57932
|
||||
|
||||
|
||||
# Both AVG and SUM has the bug 203155, Add :
|
||||
|
||||
create table t1 (pk int primary key, b int);
|
||||
insert into t1 values (1, NULL), (2, 2), (3, 4);
|
||||
select * from t1;
|
||||
select count(b), min(b), max(b), sum(b), avg(b) from t1;
|
||||
drop table t1;
|
||||
18
tools/deploy/mysql_test/t/get.test
Normal file
18
tools/deploy/mysql_test/t/get.test
Normal file
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# Test of functions get
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
create table t2 (i int primary key, j int);
|
||||
insert into t2 values (1,1),(2,2),(5,null),(4,4),(3,3);
|
||||
select * from t2 where (i) in ((1),(null)) and i = 2;
|
||||
select * from t2 where (i) in ((1),(null)) and i = 1;
|
||||
select * from t2 where (i) in ((1),(null));
|
||||
select * from t2 where (i) in ((1),(null)) and i = 1 and i = 2;
|
||||
update t2 set j=i+1 where i=2;
|
||||
select * from t2;
|
||||
drop table t2;
|
||||
18
tools/deploy/mysql_test/t/h.test
Normal file
18
tools/deploy/mysql_test/t/h.test
Normal file
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,left_table;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(c0 int primary key, c1 int , c2 int);
|
||||
|
||||
insert into t1 values(1,10,100);
|
||||
|
||||
|
||||
select c1+10 c3, c2 from t1 where c0=1;
|
||||
|
||||
drop table t1;
|
||||
107
tools/deploy/mysql_test/t/identifier_name_length.test
Normal file
107
tools/deploy/mysql_test/t/identifier_name_length.test
Normal file
@ -0,0 +1,107 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL3
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists aaaaaaaaaa222222222233333333334444444444555555555566666666661234;
|
||||
--enable_warnings
|
||||
|
||||
create table aaaaaaaaaa222222222233333333334444444444555555555566666666661234 (xxxxxxxxxx222222222233333333334444444444555555555566666666661234 int primary key);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists aaaaaaaaaa222222222233333333334444444444555555555566666666661234;
|
||||
--enable_warnings
|
||||
|
||||
#--error 1059
|
||||
create table if not exists bbbbbbbbbb222222222233333333334444444444555555555566666666661234 (yyyyyyyyyy2222222222333333333344444444445555555555666666666612345 int primary key);
|
||||
|
||||
--error 1059
|
||||
create table cccccccccc2222222222333333333344444444445555555555666666666612345 (zzzzzzzzzz222222222233333333334444444444555555555566666666661234 int primary key);
|
||||
|
||||
--error 1059
|
||||
create table dddddddddd2222222222333333333344444444445555555555666666666612345 (ssssssssss2222222222333333333344444444445555555555666666666612345 int primary key);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists alter_table1;
|
||||
--enable_warnings
|
||||
|
||||
create table alter_table1 (cc1 int primary key);
|
||||
ALTER TABLE alter_table1 CHANGE cc1 `hhhhhhhhhh222222222233333333334444444444555555555566666666661234` INT;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists alter_table1;
|
||||
--enable_warnings
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists alter_table2;
|
||||
--enable_warnings
|
||||
|
||||
create table alter_table2 (cc2 int primary key);
|
||||
#--error 1059
|
||||
ALTER TABLE alter_table2 CHANGE cc2 `gggggggggg2222222222333333333344444444445555555555666666666612345` INT;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists alter_table2;
|
||||
drop database if exists vffvvvvvvv222222222233333333334444444444555555555566666666661234;
|
||||
--enable_warnings
|
||||
create database vffvvvvvvv222222222233333333334444444444555555555566666666661234;
|
||||
|
||||
drop database if exists vffvvvvvvv222222222233333333334444444444555555555566666666661234;
|
||||
|
||||
#--error 1059
|
||||
create database if not exists vvvvvvvvvv2222222222333333333344444444445555555555666666666612345;
|
||||
drop database if exists vvvvvvvvvv2222222222333333333344444444445555555555666666666612345;
|
||||
|
||||
##when bytes number of name exceeds 192,return error 1059
|
||||
--error 1059
|
||||
create database vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666a193;
|
||||
--error 1059
|
||||
use vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666a193;
|
||||
--error 1059
|
||||
drop database vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666612345vvvvvvvvvv2222222222333333333344444444445555555555666666666a193;
|
||||
|
||||
##name can not ended with ' '
|
||||
--error 1102
|
||||
create database `adc `;
|
||||
--error 1102
|
||||
drop database `adc `;
|
||||
--error 1102
|
||||
use `adc `;
|
||||
|
||||
##when bytes number of name is between 65 and 191,return error 1102
|
||||
create database if not exists vvvvvvvvvv2222222222333333333344444444445555555555666666666612a65;
|
||||
drop database vvvvvvvvvv2222222222333333333344444444445555555555666666666612a65;
|
||||
--error 1049
|
||||
use vvvvvvvvvv2222222222333333333344444444445555555555666666666612a65;
|
||||
|
||||
#when database name is prefix of '#mysql50#' and end of these alpha '~' ,'.', '\\' ,'/' return error 1102
|
||||
--error 1102
|
||||
create database `#mysql50#~`;
|
||||
--error 1102
|
||||
drop database `#mysql50#~`;
|
||||
--error 1102
|
||||
use `#mysql50#~`;
|
||||
|
||||
--error 1102
|
||||
create database `#mysql50#.`;
|
||||
--error 1102
|
||||
drop database `#mysql50#.`;
|
||||
--error 1102
|
||||
use `#mysql50#.`;
|
||||
|
||||
--error 1102
|
||||
create database `#mysql50#\\`;
|
||||
--error 1102
|
||||
drop database `#mysql50#\\`;
|
||||
--error 1102
|
||||
use `#mysql50#\\`;
|
||||
|
||||
--error 1102
|
||||
create database `#mysql50#/`;
|
||||
--error 1102
|
||||
drop database `#mysql50#/`;
|
||||
--error 1102
|
||||
use `#mysql50#/`;
|
||||
35
tools/deploy/mysql_test/t/idx_const_basic_one_bool.test
Normal file
35
tools/deploy/mysql_test/t/idx_const_basic_one_bool.test
Normal file
@ -0,0 +1,35 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
#case:int as idx
|
||||
--disable_warnings
|
||||
drop table if exists tbl1;
|
||||
--enable_warnings
|
||||
create table tbl1 (pk int,i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3),i6 bool, gmt_create datetime default now(), gmt_modify datetime default now(),primary key(pk));
|
||||
insert into tbl1(pk,i1,v2,i3,i4,d4,i5,i6) values(1,1,'abc12','1agc',1.25,'2014-01-01 12:00:00',23.23,1),
|
||||
(2,10,'23abc12','4agc1',-0.25,'2015-11-01 12:00:00',-23.230,0),
|
||||
(3,201,'xx23abc12','cagc1',-2.25,'2015-11-21 11:20:10',3.231,1),
|
||||
(4,80,'zx23abc12','zcagc1',2.25,'2013-01-21 11:20:10',-3.231,1),
|
||||
(5,53,'cx23abc12','rcagc1',109.25,'2016-01-22 11:20:10',-13.131,0),
|
||||
(6,78,'tx23abc12','icagc1',-109.25,'2014-09-16 16:24:00',-13.131,1),
|
||||
(7,400,'yx23abc12','ocagc1',85.85,'2014-09-17 16:20:21',-93.131,0),
|
||||
(8,50,'vx23abc12','wcagc1',-85.85,'2014-09-10 16:20:21',93.131,1),
|
||||
(9,610,'ukx23abc12','pecagc1',-1.85,'2014-09-19 16:20:21',99.131,0),
|
||||
(10,42,'kx23abc12','ecagc1',-85.85,'2014-09-18 16:20:21',-99.131,1),
|
||||
(11,null,null,null,null,null,null,null);
|
||||
create index idx_1 on tbl1(i6);
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -6 YEAR) and gmt_create>=date_sub(current_timestamp(), INTERVAL 6 YEAR) ;
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -6 YEAR) and gmt_create>=date_sub(current_timestamp(), INTERVAL 6 YEAR) and i6 in ('0','1');
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -6 YEAR) and gmt_create>=date_sub(current_timestamp(), INTERVAL 6 YEAR) and i6 in ('1','0');
|
||||
select pk,i1,i6 from tbl1 where i6=true;
|
||||
select pk,i1,i6 from tbl1 where i6=false;
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -16 minute) and gmt_create>=date_sub(current_timestamp(), INTERVAL 16 minute) and pk<=11;
|
||||
update tbl1 set i1=i1*2/2 where gmt_create<=date_sub(current_timestamp(), INTERVAL -16 minute) and gmt_create>=date_sub(current_timestamp(), INTERVAL 16 minute) and pk<=11;
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -16 minute) and gmt_create>=date_sub(current_timestamp(), INTERVAL 16 minute) and pk<=11;
|
||||
delete from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -16 minute) and gmt_create>=date_sub(current_timestamp(), INTERVAL 16 minute) and pk<=11;
|
||||
select pk,i1,i6 from tbl1 where gmt_create<=date_sub(current_timestamp(), INTERVAL -16 minute) and gmt_create>=date_sub(current_timestamp(), INTERVAL 16 minute) and pk<=11;
|
||||
31
tools/deploy/mysql_test/t/idx_unique_many_idx_one_ins.test
Normal file
31
tools/deploy/mysql_test/t/idx_unique_many_idx_one_ins.test
Normal file
@ -0,0 +1,31 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: zhanyue.zzy
|
||||
#owner group: sql1
|
||||
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
#case:int as idx
|
||||
--disable_warnings
|
||||
drop table if exists tbl1;
|
||||
--enable_warnings
|
||||
create table tbl1 (pk int,i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3),i6 bool, primary key(pk));
|
||||
insert into tbl1 values(1,1,'abc12','1agc',1.25,'2014-01-01 12:00:00',23.23,1),
|
||||
(2,10,'23abc12','4agc1',-0.25,'2015-11-01 12:00:00',-23.230,0),
|
||||
(3,201,'xx23abc12','cagc1',-2.25,'2015-11-21 11:20:10',3.231,1),
|
||||
(4,80,'zx23abc12','zcagc1',2.25,'2013-01-21 11:20:10',-3.231,1),
|
||||
(5,53,'cx23abc12','rcagc1',109.25,'2016-01-22 11:20:10',-13.131,0),
|
||||
(6,78,'tx23abc12','icagc1',-109.25,'2014-09-16 16:24:00',-13.531,1),
|
||||
(7,400,'yx23abc12','ocagc1',85.85,'2014-09-17 16:20:21',-93.131,0),
|
||||
(8,50,'vx23abc12','wcagc1',-85.85,'2014-09-10 16:20:21',93.131,1),
|
||||
(9,610,'ukx23abc12','pecagc1',-1.85,'2014-09-19 16:20:21',99.131,0),
|
||||
(10,610,'kx23abc12','ecagc1',-85.86,'2014-09-18 16:20:21',-99.131,1),
|
||||
(11,null,null,null,null,null,null,null);
|
||||
--error 1062
|
||||
create unique index idx_1 on tbl1(i1);
|
||||
create unique index idx_2 on tbl1(v2);
|
||||
create unique index idx_3 on tbl1(i3);
|
||||
create unique index idx_5 on tbl1(d4);
|
||||
create unique index idx_7 on tbl1(i1,v2,i3,d4,i6);
|
||||
#--source mysql_test/include/check_idx_error.inc
|
||||
drop table tbl1;
|
||||
42
tools/deploy/mysql_test/t/index_14_hint.test
Normal file
42
tools/deploy/mysql_test/t/index_14_hint.test
Normal file
@ -0,0 +1,42 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: yibo.tyf
|
||||
#owner group: sql1
|
||||
|
||||
#test:
|
||||
#create index objecting to columns
|
||||
###TODO regenerate result file after physicalplan output is ready
|
||||
--disable_query_log
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
--real_sleep 1
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
|
||||
#init data table and index table
|
||||
create table t1 (c1 int, c2 int, c3 int, c4 int, primary key(c1));
|
||||
create index i1 on t1 (c2);
|
||||
create index i2 on t1 (c3, c4);
|
||||
create index i3 on t1 (c3) storing(c4);
|
||||
replace into t1 values (1,1,2,1),(2,2,1,null),(3,3,null,null),(4,null,null,null);
|
||||
select * from t1;
|
||||
|
||||
select /*+ index(t1 i2) */ * from t1 where c3=1;
|
||||
|
||||
let $index_name = __idx_3003_i3;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
|
||||
select * from t1 where c3=1;
|
||||
select /*+ index(a1 i2) */ * from t1 as a1 where c3 in(1,2);
|
||||
select * from t1 as a1 where a1.c3 in (1,2);
|
||||
select /*+ index(t1 primary) */ * from t1 where c3 in(1,2);
|
||||
|
||||
select * from t1 where c3 is null;
|
||||
select /*+ index(t1 i2) */ * from t1 where c3 is null;
|
||||
select /*+ index(t1 primary) */ * from t1 where c3 is null;
|
||||
|
||||
select /*+ index(t1 i4) */ * from t1 where c3 is null;
|
||||
|
||||
drop table t1;
|
||||
87
tools/deploy/mysql_test/t/index_47_NULL.test
Normal file
87
tools/deploy/mysql_test/t/index_47_NULL.test
Normal file
@ -0,0 +1,87 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 用于测试NULL上的索引相关
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1
|
||||
(
|
||||
pk1 INT primary key,
|
||||
key1 INT,
|
||||
key2 VARCHAR(20),
|
||||
key3 VARCHAR(20)
|
||||
);
|
||||
|
||||
insert into t1 values(1,12,'a','a1'),(2,11,'a','b1'),(3,10,'b','b1'),(4,9,'c','c1'),
|
||||
(5,8,NULL,'d1'),(6,7,NULL,'b1'),(7,6,NULL,'b1'),
|
||||
(8,5,'a',NULL),(9,4,'a',NULL),(10,3,NULL,NULL),
|
||||
(11,2,'',NULL),(12,1,NULL,'');
|
||||
|
||||
create index i1 on t1(key2,key3);
|
||||
|
||||
let $index_name=__idx_3003_i1;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
|
||||
##
|
||||
select * from t1 where key2='a' and key3=NULL;
|
||||
select pk1 from t1 where key2='a' and key3=NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2='a' and key3>NULL;
|
||||
select pk1 from t1 where key2='a' and key3>NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2='a' and key3<NULL;
|
||||
select pk1 from t1 where key2='a' and key3<NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2='a' and key3>=NULL;
|
||||
select pk1 from t1 where key2='a' and key3>=NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2='a' and key3<=NULL;
|
||||
select pk1 from t1 where key2='a' and key3<=NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3='b1';
|
||||
select pk1 from t1 where key2=NULL and key3='b1';
|
||||
|
||||
##
|
||||
select * from t1 where key2>NULL and key3='b1';
|
||||
select pk1 from t1 where key2>NULL and key3='b1';
|
||||
|
||||
##
|
||||
select * from t1 where key2<NULL and key3='b1';
|
||||
select pk1 from t1 where key2<NULL and key3='b1';
|
||||
|
||||
##
|
||||
select * from t1 where key2>=NULL and key3='b1';
|
||||
select pk1 from t1 where key2>=NULL and key3='b1';
|
||||
|
||||
##
|
||||
select * from t1 where key2<=NULL and key3='b1';
|
||||
select pk1 from t1 where key2<=NULL and key3='b1';
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3=NULL;
|
||||
select pk1 from t1 where key2=NULL and key3=NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3<NULL;
|
||||
select pk1 from t1 where key2=NULL and key3<NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3>NULL;
|
||||
select pk1 from t1 where key2=NULL and key3>NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3<=NULL;
|
||||
select pk1 from t1 where key2=NULL and key3<=NULL;
|
||||
|
||||
##
|
||||
select * from t1 where key2=NULL and key3>=NULL;
|
||||
select pk1 from t1 where key2=NULL and key3>=NULL;
|
||||
30
tools/deploy/mysql_test/t/index_49_alias.test
Normal file
30
tools/deploy/mysql_test/t/index_49_alias.test
Normal file
@ -0,0 +1,30 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: 测试带别名的并且走索引的语句
|
||||
|
||||
--disable_query_log
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
--real_sleep 1
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
|
||||
|
||||
create table t1 (c1 int primary key, c2 int, c3 int, c4 int);
|
||||
create index i1 on t1(c2);
|
||||
|
||||
let $index_name = __idx_3003_i1;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
|
||||
insert into t1 values(10, 1, 1, 1), (9, 2, 2, 2), (8, 3, 3, 3), (7, 4, 4, 4);
|
||||
|
||||
select * from t1 where c2 > 0 and c2 < 5;
|
||||
select * from t1 b where b.c2 > 0 and b.c2 < 5;
|
||||
select /*+index(t1 i1) */ * from t1 b where b.c2 > 0 and b.c2 < 5;
|
||||
select /*+index(b i1) */ * from t1 b where b.c2 > 0 and b.c2 < 5;
|
||||
|
||||
drop table t1;
|
||||
109
tools/deploy/mysql_test/t/information_schema.test
Normal file
109
tools/deploy/mysql_test/t/information_schema.test
Normal file
@ -0,0 +1,109 @@
|
||||
--result_format 4
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL3
|
||||
# description:
|
||||
#
|
||||
|
||||
# tags: inner_table, schema
|
||||
|
||||
let $cpu = 1;
|
||||
let $memory = 1073741824;
|
||||
let $min_memory = 1073741824;
|
||||
let $disk = 536870912;
|
||||
let $iops = 100000;
|
||||
let $session = 64;
|
||||
|
||||
use information_schema;
|
||||
desc information_schema.columns;
|
||||
desc information_schema.tables;
|
||||
desc information_schema.session_variables;
|
||||
desc information_schema.table_constraints;
|
||||
desc information_schema.character_sets;
|
||||
desc information_schema.global_variables;
|
||||
desc information_schema.statistics;
|
||||
desc information_schema.schemata;
|
||||
desc information_schema.views;
|
||||
desc information_schema.files;
|
||||
|
||||
#select * from information_schema.columns;
|
||||
--sorted_result
|
||||
--replace_column 8 NULL 9 NULL 10 NULL 15 NULL 16 NULL
|
||||
select * from information_schema.tables where table_schema in ('oceanbase', 'mysql', 'information_schema') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
--echo test
|
||||
#--sorted_result
|
||||
#select * from information_schema.session_variables where variable_name != 'version_comment' and variable_name != 'version' order by VARIABLE_NAME;
|
||||
#--sorted_result
|
||||
#select * from information_schema.global_variables where variable_name != 'version_comment' and variable_name != 'version' order by VARIABLE_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.table_constraints where table_schema in ('oceanbase', 'mysql', 'information_schema') order by CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.character_sets;
|
||||
--sorted_result
|
||||
select * from information_schema.statistics where table_schema in ('oceanbase', 'mysql', 'information_schema') and TABLE_NAME not like "ob_all_proxy%" order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.schemata where schema_name in ('oceanbase', 'mysql', 'information_schema') order by CATALOG_NAME, SCHEMA_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.views where table_schema in ('oceanbase', 'mysql', 'information_schema') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
# should be empty
|
||||
--sorted_result
|
||||
select * from information_schema.files;
|
||||
|
||||
create database test1;
|
||||
use test1;
|
||||
create table t1tenant1(c1 bigint primary key, c2 bigint);
|
||||
connection default;
|
||||
--replace_column 8 NULL 9 NULL 10 NULL 15 NULL 16 NULL
|
||||
select * from information_schema.tables where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
|
||||
create index t1tenant1_idx1 on t1tenant1(c2, c1);
|
||||
create unique index t1tenant1_uidx on t1tenant1(c2);
|
||||
create view vt1tenant1 as select c1,c2 from t1tenant1;
|
||||
|
||||
use information_schema;
|
||||
#select * from information_schema.columns;
|
||||
#select * from information_schema.tables;
|
||||
--sorted_result
|
||||
select * from information_schema.table_constraints where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') order by CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME;
|
||||
|
||||
--sorted_result
|
||||
select * from information_schema.schemata where schema_name in ('oceanbase', 'mysql', 'information_schema', 'test1') order by CATALOG_NAME, SCHEMA_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.views where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
|
||||
|
||||
# login using sys tenant
|
||||
connect (conn_sys,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
set @@session.ob_query_timeout = 60000000;
|
||||
use information_schema;
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
#select * from information_schema.schemata;
|
||||
#select * from information_schema.columns;
|
||||
#select * from information_schema.session_variables where variable_name != 'version_comment' and variable_name != 'version' order by VARIABLE_NAME;
|
||||
#select * from information_schema.global_variables where variable_name != 'version_comment' and variable_name != 'version' order by VARIABLE_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.table_constraints where table_schema in ('oceanbase', 'mysql', 'information_schema', 'SYS', 'LBACSYS', 'ORAAUDITOR') order by CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.statistics where table_schema in ('oceanbase', 'mysql', 'information_schema', 'SYS', 'LBACSYS', 'ORAAUDITOR') and TABLE_NAME not like "ob_all_proxy%" order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.views where table_schema in ('oceanbase', 'mysql', 'information_schema', 'SYS', 'LBACSYS', 'ORAAUDITOR') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
|
||||
|
||||
--error 1049
|
||||
use test1;
|
||||
connection default;
|
||||
use information_schema;
|
||||
#select * from information_schema.columns;
|
||||
#select * from information_schema.schemata;
|
||||
--sorted_result
|
||||
select * from information_schema.table_constraints where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') order by CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.statistics where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') and TABLE_NAME not like "ob_all_proxy%" order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
--sorted_result
|
||||
select * from information_schema.views where table_schema in ('oceanbase', 'mysql', 'information_schema', 'test1') order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
|
||||
|
||||
drop database test1;
|
||||
104
tools/deploy/mysql_test/t/intersect.test
Normal file
104
tools/deploy/mysql_test/t/intersect.test
Normal file
@ -0,0 +1,104 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# Test of functions intersect
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t8;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
create table t2(c1 int primary key, c2 int);
|
||||
create table t3(c1 int, c2 int primary key);
|
||||
create table t4(c1 int primary key, c2 int);
|
||||
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
insert into t2 values(0,0),(2,2),(4,4),(6,6);
|
||||
insert into t3 values(1,1),(3,3),(5,5),(7,7);
|
||||
insert into t4 values(1,0),(2,0),(3,1),(4,1);
|
||||
|
||||
(select * from t1 where false ) intersect (select * from t2 where false);
|
||||
--error 1064
|
||||
(select * from t1 where false ) intersect all (select * from t2 where false);
|
||||
(select * from t1 where false ) intersect select * from t2;
|
||||
--error 1064
|
||||
(select * from t1 where false ) intersect all select * from t2;
|
||||
select * from t1 intersect (select * from t2 where false);
|
||||
--error 1064
|
||||
select * from t1 intersect all (select * from t2 where false);
|
||||
(select * from t1 where false) intersect (select * from t2 where false) intersect (select * from t3 where false);
|
||||
--error 1064
|
||||
(select * from t1 where false) intersect all (select * from t2 where false) intersect (select * from t3 where false);
|
||||
|
||||
|
||||
#
|
||||
select c1 from t1 intersect select c1 from t1;
|
||||
--error 1064
|
||||
select c1 from t1 intersect all select c1 from t1;
|
||||
select c1 from t1 intersect select c1 from t4;
|
||||
--error 1064
|
||||
select c1 from t1 intersect all select c1 from t4;
|
||||
select c1 from t4 intersect select c1 from t1;
|
||||
--error 1064
|
||||
select c1 from t4 intersect all select c1 from t1;
|
||||
select c1 from t2 intersect select c1 from t3;
|
||||
--error 1064
|
||||
select c1 from t2 intersect all select c1 from t3;
|
||||
select c1 from t1 intersect select c1 from t2;
|
||||
--error 1064
|
||||
select c1 from t1 intersect all select c1 from t2;
|
||||
|
||||
|
||||
# distinct
|
||||
select c2 from t4 intersect select c2 from t1;
|
||||
--error 1064
|
||||
select c2 from t4 intersect all select c2 from t1;
|
||||
select c2 from t1 intersect select c2 from t4;
|
||||
--error 1064
|
||||
select c2 from t1 intersect all select c2 from t4;
|
||||
select * from t1 intersect (select * from t2 union select * from t3) ;
|
||||
--error 1064
|
||||
select * from t1 intersect all (select * from t2 union select * from t3) ;
|
||||
(select * from t1 intersect select * from t2) union (select * from t1 intersect select * from t3);
|
||||
--error 1064
|
||||
select * from t1 intersect all (select * from t2 union select * from t3) ;
|
||||
select c2 from t1 intersect select c2 from t3 intersect select c2 from t4;
|
||||
--error 1064
|
||||
select c2 from t1 intersect all select c2 from t3 intersect select c2 from t4;
|
||||
select c2 from t1 intersect (select c2 from t3 intersect select c2 from t4);
|
||||
--error 1064
|
||||
select c2 from t1 intersect all (select c2 from t3 intersect select c2 from t4);
|
||||
--disable_warnings
|
||||
drop table if exists t5,t6;
|
||||
--enable_warnings
|
||||
create table t5(c1 int primary key, c2 int);
|
||||
create table t6(c1 int primary key, c2 int);
|
||||
|
||||
insert into t5 values(1,1),(2,2),(3,3),(4,4),(5,5),(6,2),(7,3),(8,6),(9,6),(10,4),(11,2);
|
||||
insert into t6 values(0,0),(2,2),(4,4),(6,6),(1,2),(3,4),(5,6);
|
||||
select c2 from t5 intersect select c2 from t6;
|
||||
--error 1064
|
||||
select c2 from t5 intersect all select c2 from t6;
|
||||
--error 1222
|
||||
select c2 from t5 intersect select c1,c2 from t6;
|
||||
|
||||
|
||||
create table t8 (c1 BINARY(99) ,c2 INTEGER(127) ,c3 VARBINARY(71) ,c4 BINARY(65) ,c5 BIGINT(127) ,c6 INTEGER(127) ,c7 INT(127) ,c8 INTEGER(127) ,c9 NUMERIC(64,25) ,c10 VARBINARY(55) ,c11 BIGINT(127) ,c12 VARCHAR(86) ,c13 INTEGER(127) ,c14 INT(127) ,c15 INTEGER(127) ,c16 DECIMAL(64,15) ,c17 INTEGER(127) ,c18 VARBINARY(76) ,c19 INTEGER(127) , primary key(c7,c6), index i_OkcN(c19) global, index i_ahayugXY(c10,c18) global, index i_iA(c16,c2) global) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin PARTITION BY KEY(c7) PARTITIONS 20;
|
||||
|
||||
insert into t8 values('cdxLVdvvJjcoHFBECqXKkRGoMXYgNsTpJRrqYaluQdfEeB00000',0,'RetSgyIigYXIPgBXBsmZHQZQPLWcGoELCf00000','wD00000',0,0,0,0,0.0000000000000000000000000,'ieLhJAFmNCq00000',0,'DcKPncNvJjyYcNJKFmVUVhqvgUlLfINbycifYNHjzqALoLfn00000',0,0,0,0.000000000000000,0,'MojimRsQZuotWXMuvSQVDSdCmOaloSXNLRTxMYYXaxGbtuk00000',0);
|
||||
|
||||
explain (select /*+USE_HASH_AGGREGATION*/ c15 from (select c15 from t8) except (select c15 from t8) order by 1 limit 1000) union all (select t8_alias1.c10 from t8 t8_alias1 limit 1);
|
||||
(select /*+USE_HASH_AGGREGATION*/ c15 from (select c15 from t8) except (select c15 from t8) order by 1 limit 1000) union all (select t8_alias1.c10 from t8 t8_alias1 limit 1);
|
||||
explain (select /*+USE_HASH_AGGREGATION*/ c15 from (select c15 from t8) intersect (select c15 from t8) order by 1 limit 1000) union all (select t8_alias1.c10 from t8 t8_alias1 limit 1);
|
||||
(select /*+USE_HASH_AGGREGATION*/ c15 from (select c15 from t8) intersect (select c15 from t8) order by 1 limit 1000) union all (select t8_alias1.c10 from t8 t8_alias1 limit 1);
|
||||
|
||||
drop table t8;
|
||||
create table t8 (c1 BINARY(99) ,c2 INTEGER(127) ,c3 VARBINARY(71) ,c4 BINARY(65) ,c5 BIGINT(127) ,c6 INTEGER(127) ,c7 INT(127) ,c8 INTEGER(127) ,c9 NUMERIC(64,25) ,c10 VARBINARY(55) ,c11 BIGINT(127) ,c12 VARCHAR(86) ,c13 INTEGER(127) ,c14 INT(127) ,c15 INTEGER(127) ,c16 DECIMAL(64,15) ,c17 INTEGER(127) ,c18 VARBINARY(76) ,c19 INTEGER(127) , primary key(c7,c6), index i_OkcN(c19), index i_ahayugXY(c10,c18), index i_iA(c16,c2));
|
||||
insert into t8 values('cdxLVdvvJjcoHFBECqXKkRGoMXYgNsTpJRrqYaluQdfEeB00000',0,'RetSgyIigYXIPgBXBsmZHQZQPLWcGoELCf00000','wD00000',0,0,0,0,0.0000000000000000000000000,'ieLhJAFmNCq00000',0,'DcKPncNvJjyYcNJKFmVUVhqvgUlLfINbycifYNHjzqALoLfn00000',0,0,0,0.000000000000000,0,'MojimRsQZuotWXMuvSQVDSdCmOaloSXNLRTxMYYXaxGbtuk00000',0);
|
||||
|
||||
explain ((select c6 from t8 where c6 < 1000) except (select c6 from t8 where c6 > -1000) order by c6 limit 1000) union all (select t8_alias1.c10 from t8 t8_alias1 limit 1);
|
||||
|
||||
drop table t1,t2,t3,t4,t5,t6, t8;
|
||||
68
tools/deploy/mysql_test/t/join_basic.test
Normal file
68
tools/deploy/mysql_test/t/join_basic.test
Normal file
@ -0,0 +1,68 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL3
|
||||
# description:
|
||||
# tags: dml
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists persons,orders, t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
create table persons (id_p int primary key, lastname varchar(20), firstname varchar(20), address varchar(20), city varchar(20));
|
||||
|
||||
insert into persons values(1,'a','a1','a2', 'a3');
|
||||
insert into persons values(2,'b','b1','b2', 'b3');
|
||||
insert into persons values(3,'c','c1','c2', 'c3');
|
||||
|
||||
|
||||
create table orders(id_o int primary key, orderno int, id_p int);
|
||||
insert into orders values(1,1111,3);
|
||||
insert into orders values(2,2222,3);
|
||||
insert into orders values(3,3333,1);
|
||||
insert into orders values(4,4444,1);
|
||||
insert into orders values(5,5555,65);
|
||||
|
||||
select persons.lastname, persons.firstname, orders.orderno from persons left join orders on persons.id_p=orders.id_p order by persons.lastname, persons.firstname, orders.orderno;
|
||||
--sorted_result
|
||||
select persons.lastname, persons.firstname, orders.orderno from persons right join orders on persons.id_p=orders.id_p order by persons.lastname, persons.firstname, orders.orderno;
|
||||
|
||||
select persons.lastname, persons.firstname, orders.orderno
|
||||
from persons
|
||||
inner join orders
|
||||
on persons.id_p=orders.id_p
|
||||
order by persons.lastname, persons.firstname, orders.orderno;
|
||||
|
||||
select persons.lastname, persons.firstname, orders.orderno from persons full join orders on persons.id_p=orders.id_p order by persons.lastname, persons.firstname, orders.orderno;
|
||||
|
||||
create table t1(c1 date);
|
||||
create table t2(c1 int primary key);
|
||||
insert into t1 values('2078-10-10'), ('1970-11-01');
|
||||
insert into t2 values(320);
|
||||
select * from t1, t2 where t1.c1<=t2.c1;
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1(a bigint);
|
||||
insert into t1 values (32);
|
||||
|
||||
drop table if exists t2;
|
||||
create table t2(b year(4), key key_b (b));
|
||||
insert into t2 values (1901);
|
||||
|
||||
create table t3(c year(4));
|
||||
insert into t3 values (1901);
|
||||
|
||||
select a, b from t1, t2 where a > b;
|
||||
select a, c from t1, t3 where a > c;
|
||||
|
||||
drop table if exists t1, t2;
|
||||
create table t1(c1 bigint(92));
|
||||
create table t2(c1 year(4) primary key);
|
||||
insert into t1 values(32);
|
||||
insert into t2 values(1901);
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t1, t2 where t1.c1>=t2.c1;
|
||||
|
||||
drop table orders,persons, t1, t2, t3;
|
||||
74
tools/deploy/mysql_test/t/join_equivalent_transfer.test
Normal file
74
tools/deploy/mysql_test/t/join_equivalent_transfer.test
Normal file
@ -0,0 +1,74 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL1
|
||||
# tags: optimizer, join
|
||||
# description:
|
||||
#
|
||||
--disable_abort_on_error
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(pk int primary key, c1 int, c2 int);
|
||||
insert into t1 values(1,1,1),(2,2,2);
|
||||
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from t1 where c2=1 and c1=c2 and pk=c1;
|
||||
--enable_result_log
|
||||
select * from t1 where c2=1 and c1=c2 and pk=c1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
create table t1(pk int primary key, c1 int, c2 int, c3 int,c4 int , c5 int, c6 int, c7 int, c8 int, c9 int, c10 int);
|
||||
|
||||
insert into t1 values(1,1,1,1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2,2,2,2),(3,2,2,2,3,2,3,2,3,3,3);
|
||||
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from t1 where c10=1 and c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and pk=c1;
|
||||
--enable_result_log
|
||||
select * from t1 where c10=1 and c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and pk=c1;
|
||||
select * from t1 where c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and c10=1 and pk=c1;
|
||||
select * from t1 where c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and pk=c1;
|
||||
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from t1 where c10>1 and c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and pk=c1;
|
||||
--enable_result_log
|
||||
select * from t1 where c10>1 and c9=c10 and c8=c9 and c7=c8 and c6=c7 and c5=c6 and c4=c5 and c3=c4 and c2=c3 and c1=c2 and pk=c1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
|
||||
create table t1(pk int primary key, c1 int, c2 int);
|
||||
|
||||
insert into t1 values(1,1,1),(2,2,2);
|
||||
|
||||
create table t2(pk int primary key, c1 int, c2 int);
|
||||
|
||||
insert into t2 values(1,1,1),(2,2,2);
|
||||
|
||||
select t1.pk,t2.c2 from t1,t2 where t1.pk=t2.pk and t1.pk=1;
|
||||
select t1.pk,t2.c2 from t1,t2 where t1.pk=t2.pk and t1.pk>1;
|
||||
|
||||
|
||||
select t1.pk,t2.c2 from t1 INNER join t2 on t1.pk=t2.pk and t2.pk=1;
|
||||
|
||||
select t1.pk,t2.c2 from t1 LEFT join t2 on t1.pk=t2.pk and t2.pk=1;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select t1.pk,t2.c2 from t1 LEFT join t2 on t1.pk=t2.pk and t2.pk=1;
|
||||
--enable_result_log
|
||||
|
||||
select t1.pk,t2.c2 from t1 RIGHT join t2 on t1.pk=t2.pk and t2.pk=1;
|
||||
|
||||
--sorted_result
|
||||
select t1.pk,t2.c2 from t1 FULL join t2 on t1.pk=t2.pk and t2.pk=1;
|
||||
87
tools/deploy/mysql_test/t/join_many_table.test
Normal file
87
tools/deploy/mysql_test/t/join_many_table.test
Normal file
@ -0,0 +1,87 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL1
|
||||
# tags: join
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
set global ob_sql_work_area_percentage = 100;
|
||||
sleep 10;
|
||||
--enable_query_log
|
||||
#
|
||||
##
|
||||
## Test of join of many tables.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id int,
|
||||
token varchar(100) ,
|
||||
count int ,
|
||||
qty int,
|
||||
phone char(1) ,
|
||||
stamp datetime ,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21');
|
||||
INSERT INTO t1 VALUES (22,'e45703b64de71482360de8fec94c3ade',4,5000,'y','1999-12-23 17:22:21');
|
||||
INSERT INTO t1 VALUES (18,'346d1cb63c89285b2351f0ca4de40eda',3,13200,'b','1999-12-23 11:58:04');
|
||||
INSERT INTO t1 VALUES (17,'ca6ddeb689e1b48a04146b1b5b6f936a',4,15000,'b','1999-12-23 11:36:53');
|
||||
INSERT INTO t1 VALUES (16,'ca6ddeb689e1b48a04146b1b5b6f936a',3,13200,'b','1999-12-23 11:36:53');
|
||||
INSERT INTO t1 VALUES (26,'a71250b7ed780f6ef3185bfffe027983',5,1500,'b','1999-12-27 09:44:24');
|
||||
INSERT INTO t1 VALUES (24,'4d75906f3c37ecff478a1eb56637aa09',3,5400,'y','1999-12-23 17:29:12');
|
||||
INSERT INTO t1 VALUES (25,'4d75906f3c37ecff478a1eb56637aa09',4,6500,'y','1999-12-23 17:29:12');
|
||||
INSERT INTO t1 VALUES (27,'a71250b7ed780f6ef3185bfffe027983',3,6200,'b','1999-12-27 09:44:24');
|
||||
INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36');
|
||||
INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');
|
||||
--sorted_result
|
||||
select t1000.id from
|
||||
t1 as t1000
|
||||
left join t1 as t2000 on t1000.id=t2000.id
|
||||
left join t1 as t2001 on t2000.id=t2001.id
|
||||
left join t1 as t2002 on t2001.id=t2002.id
|
||||
left join t1 as t2003 on t2002.id=t2003.id
|
||||
left join t1 as t2004 on t2003.id=t2004.id
|
||||
left join t1 as t2005 on t2004.id=t2005.id
|
||||
left join t1 as t2006 on t2005.id=t2006.id
|
||||
left join t1 as t2007 on t2006.id=t2007.id
|
||||
left join t1 as t2008 on t2007.id=t2008.id
|
||||
left join t1 as t2009 on t2008.id=t2009.id
|
||||
left join t1 as t2010 on t2009.id=t2010.id
|
||||
left join t1 as t2011 on t2010.id=t2011.id
|
||||
left join t1 as t2012 on t2011.id=t2012.id
|
||||
left join t1 as t2013 on t2012.id=t2013.id
|
||||
left join t1 as t2014 on t2013.id=t2014.id
|
||||
left join t1 as t2015 on t2014.id=t2015.id
|
||||
left join t1 as t2016 on t2015.id=t2016.id
|
||||
left join t1 as t2017 on t2016.id=t2017.id
|
||||
left join t1 as t2018 on t2017.id=t2018.id
|
||||
left join t1 as t2019 on t2018.id=t2019.id
|
||||
left join t1 as t2020 on t2019.id=t2020.id
|
||||
left join t1 as t2021 on t2020.id=t2021.id
|
||||
left join t1 as t2022 on t2021.id=t2022.id
|
||||
left join t1 as t2023 on t2022.id=t2023.id
|
||||
left join t1 as t2024 on t2023.id=t2024.id
|
||||
left join t1 as t2025 on t2024.id=t2025.id
|
||||
left join t1 as t2026 on t2025.id=t2026.id
|
||||
left join t1 as t2027 on t2026.id=t2027.id
|
||||
left join t1 as t2028 on t2027.id=t2028.id
|
||||
left join t1 as t2029 on t2028.id=t2029.id
|
||||
left join t1 as t2030 on t2029.id=t2030.id
|
||||
left join t1 as t2031 on t2030.id=t2031.id;
|
||||
|
||||
#--replace_result '31 tables' 'XX tables' '61 tables' 'XX tables'
|
||||
#--error 1116
|
||||
#select t1.a from t1 as t1 left join t1 as t2 using t1.id=t2.id left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
#select a from t1 as t1 left join t1 as t2 using t1.id=t2.id left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
#--replace_result '31 tables' 'XX tables' '61 tables' 'XX tables'
|
||||
#--error 1116
|
||||
#select a from t1 as t1 left join t1 as t2 using t1.id=t2.id left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
drop table t1;
|
||||
--disable_query_log
|
||||
set global ob_sql_work_area_percentage = 5;
|
||||
#
|
||||
101
tools/deploy/mysql_test/t/join_many_table_single_field.test
Normal file
101
tools/deploy/mysql_test/t/join_many_table_single_field.test
Normal file
@ -0,0 +1,101 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL1
|
||||
# tags: optimizer, join
|
||||
# description
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
set global ob_sql_work_area_percentage = 100;
|
||||
sleep 10;
|
||||
#
|
||||
##
|
||||
## Test of join of many tables.
|
||||
#
|
||||
create table t1 (id int primary key,extra int);
|
||||
insert into t1(id) values(1),(2);
|
||||
select t1000.id from
|
||||
t1 as t1000
|
||||
left join t1 as t2000 on t1000.id=t2000.id
|
||||
left join t1 as t2001 on t2000.id=t2001.id
|
||||
left join t1 as t2002 on t2001.id=t2002.id
|
||||
left join t1 as t2003 on t2002.id=t2003.id
|
||||
left join t1 as t2004 on t2003.id=t2004.id
|
||||
left join t1 as t2005 on t2004.id=t2005.id
|
||||
left join t1 as t2006 on t2005.id=t2006.id
|
||||
left join t1 as t2007 on t2006.id=t2007.id
|
||||
left join t1 as t2008 on t2007.id=t2008.id
|
||||
left join t1 as t2009 on t2008.id=t2009.id
|
||||
left join t1 as t2010 on t2009.id=t2010.id
|
||||
left join t1 as t2011 on t2010.id=t2011.id
|
||||
left join t1 as t2012 on t2011.id=t2012.id
|
||||
left join t1 as t2013 on t2012.id=t2013.id
|
||||
left join t1 as t2014 on t2013.id=t2014.id
|
||||
left join t1 as t2015 on t2014.id=t2015.id
|
||||
left join t1 as t2016 on t2015.id=t2016.id
|
||||
left join t1 as t2017 on t2016.id=t2017.id
|
||||
left join t1 as t2018 on t2017.id=t2018.id
|
||||
left join t1 as t2019 on t2018.id=t2019.id
|
||||
left join t1 as t2020 on t2019.id=t2020.id
|
||||
left join t1 as t2021 on t2020.id=t2021.id
|
||||
left join t1 as t2022 on t2021.id=t2022.id
|
||||
left join t1 as t2023 on t2022.id=t2023.id
|
||||
left join t1 as t2024 on t2023.id=t2024.id
|
||||
left join t1 as t2025 on t2024.id=t2025.id
|
||||
left join t1 as t2026 on t2025.id=t2026.id
|
||||
left join t1 as t2027 on t2026.id=t2027.id
|
||||
left join t1 as t2028 on t2027.id=t2028.id
|
||||
left join t1 as t2029 on t2028.id=t2029.id
|
||||
left join t1 as t2030 on t2029.id=t2030.id
|
||||
left join t1 as t2031 on t2030.id=t2031.id;
|
||||
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select t1000.id from
|
||||
t1 as t1000
|
||||
left join t1 as t2000 on t1000.id=t2000.id
|
||||
left join t1 as t2001 on t2000.id=t2001.id
|
||||
left join t1 as t2002 on t2001.id=t2002.id
|
||||
left join t1 as t2003 on t2002.id=t2003.id
|
||||
left join t1 as t2004 on t2003.id=t2004.id
|
||||
left join t1 as t2005 on t2004.id=t2005.id
|
||||
left join t1 as t2006 on t2005.id=t2006.id
|
||||
left join t1 as t2007 on t2006.id=t2007.id
|
||||
left join t1 as t2008 on t2007.id=t2008.id
|
||||
left join t1 as t2009 on t2008.id=t2009.id
|
||||
left join t1 as t2010 on t2009.id=t2010.id
|
||||
left join t1 as t2011 on t2010.id=t2011.id
|
||||
left join t1 as t2012 on t2011.id=t2012.id
|
||||
left join t1 as t2013 on t2012.id=t2013.id
|
||||
left join t1 as t2014 on t2013.id=t2014.id
|
||||
left join t1 as t2015 on t2014.id=t2015.id
|
||||
left join t1 as t2016 on t2015.id=t2016.id
|
||||
left join t1 as t2017 on t2016.id=t2017.id
|
||||
left join t1 as t2018 on t2017.id=t2018.id
|
||||
left join t1 as t2019 on t2018.id=t2019.id
|
||||
left join t1 as t2020 on t2019.id=t2020.id
|
||||
left join t1 as t2021 on t2020.id=t2021.id
|
||||
left join t1 as t2022 on t2021.id=t2022.id
|
||||
left join t1 as t2023 on t2022.id=t2023.id
|
||||
left join t1 as t2024 on t2023.id=t2024.id
|
||||
left join t1 as t2025 on t2024.id=t2025.id
|
||||
left join t1 as t2026 on t2025.id=t2026.id
|
||||
left join t1 as t2027 on t2026.id=t2027.id
|
||||
left join t1 as t2028 on t2027.id=t2028.id
|
||||
left join t1 as t2029 on t2028.id=t2029.id
|
||||
left join t1 as t2030 on t2029.id=t2030.id
|
||||
left join t1 as t2031 on t2030.id=t2031.id;
|
||||
--enable_result_log
|
||||
#--replace_result '31 tables' 'XX tables' '61 tables' 'XX tables'
|
||||
#--error 1116
|
||||
#select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
#select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
#--replace_result '31 tables' 'XX tables' '61 tables' 'XX tables'
|
||||
#--error 1116
|
||||
#select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
drop table t1;
|
||||
set global ob_sql_work_area_percentage = 5;
|
||||
#
|
||||
37
tools/deploy/mysql_test/t/join_null.test
Normal file
37
tools/deploy/mysql_test/t/join_null.test
Normal file
@ -0,0 +1,37 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL1
|
||||
# description
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t5,t6;
|
||||
--enable_warnings
|
||||
#
|
||||
##
|
||||
## bug http://bugfree.corp.taobao.com/bug/199785
|
||||
## join with null values
|
||||
##
|
||||
CREATE TABLE t1 (
|
||||
pk int primary key,
|
||||
id int,
|
||||
gender varchar(1)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
user_id int primary key,
|
||||
birthday datetime
|
||||
);
|
||||
|
||||
insert into t1 values (1, NULL, 'M'), (2, 1, 'M'), (3, 2, 'F'),(4, 3, 'F'),(5, 4, 'F'),(6, 5, 'M');
|
||||
insert into t2 values (1, '2002-06-09 00:00:00'),(2, '2002-06-09 00:00:00'),(100, '2002-06-09 00:00:00'),
|
||||
(3, '2002-06-09 00:00:00'),(4, '2002-06-09 00:00:00');
|
||||
|
||||
select id,gender,user_id from t1,t2 where t2.user_id=t1.id;
|
||||
####test for null safe equal with join....
|
||||
create table t5(a int);
|
||||
create table t6(a int);
|
||||
insert into t5 values (null), (null);
|
||||
insert into t6 values (null), (null);
|
||||
select * from t5, t6 where t5.a <=> t6.a;
|
||||
drop table t1,t2,t5,t6;
|
||||
71
tools/deploy/mysql_test/t/join_star.test
Normal file
71
tools/deploy/mysql_test/t/join_star.test
Normal file
@ -0,0 +1,71 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL1
|
||||
# tags: optimizer
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists tbl1,tbl2,tbl3,tbl4;
|
||||
--enable_warnings
|
||||
create table tbl1 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
create table tbl2 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6), i5 decimal(5,3), primary key(i1));
|
||||
create table tbl3 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6), i5 decimal(5,3), primary key(i1));
|
||||
create table tbl4 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6), i5 decimal(5,3), primary key(i1));
|
||||
insert into tbl1 values(1,'now','haha',1.6256,'2014-05-04 12:00:00',-10.235);
|
||||
insert into tbl1 values(2,'now','haha',-1.6256,'2014-05-04 12:00:00',1.243);
|
||||
insert into tbl1 values(3,'now','haha',1.656,'2014-05-04 12:00:00',-1.45);
|
||||
insert into tbl2 values(1,'now','haha',1.6256,'2014-05-04 12:00:00',3.45);
|
||||
insert into tbl2 values(2,'now1','haha',1.6256,'2014-05-04 12:00:00',-0.25);
|
||||
insert into tbl2 values(3,'now2','haha',1.6256,'2014-05-04 12:00:00',0.253);
|
||||
insert into tbl2 values(4,'now3','haha',1.6256,'2014-05-04 12:00:00',1.677);
|
||||
insert into tbl3 values(1,'now','haha',1.6256,'2014-05-04 12:00:00',-10.235);
|
||||
insert into tbl3 values(2,'now','haha',-1.6256,'2014-05-04 12:00:00',1.243);
|
||||
insert into tbl3 values(3,'now','haha',1.656,'2014-05-04 12:00:00',-1.45);
|
||||
insert into tbl4 values(1,'now','haha',1.6256,'2014-05-04 12:00:00',3.45);
|
||||
insert into tbl4 values(2,'now1','haha',1.6256,'2014-05-04 12:00:00',-0.25);
|
||||
insert into tbl4 values(3,'now2','haha',1.6256,'2014-05-04 12:00:00',0.253);
|
||||
insert into tbl4 values(4,'now3','haha',1.6256,'2014-05-04 12:00:00',1.677);
|
||||
select * from tbl1 join tbl2 on tbl1.i1=tbl2.i1 join tbl3 on tbl1.i1=tbl3.i1 join tbl4 on tbl1.i1=tbl4.i1;
|
||||
select * from tbl1 a join tbl2 b on a.i1=b.i1 join tbl3 c on a.i1=c.i1 join tbl4 d on a.i1=d.i1;
|
||||
select * from tbl1 join tbl2 on tbl1.i1=tbl2.i1 join tbl3 on tbl1.i1=tbl3.i1 join tbl4 on tbl1.i1=tbl4.i1 where tbl1.i1=1;
|
||||
select * from tbl1 join tbl2 on tbl1.i1=tbl2.i1 join tbl3 on tbl2.i1=tbl3.i1 join tbl4 on tbl3.i1=tbl4.i1;
|
||||
select * from tbl1 a join tbl2 b on a.i1=b.i1 join tbl3 c on b.i1=c.i1 join tbl4 d on c.i1=d.i1;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from tbl1 join tbl2 on tbl1.i1=tbl2.i1 join tbl3 on tbl1.i1=tbl3.i1 join tbl4 on tbl1.i1=tbl4.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from tbl1 a join tbl2 b on a.i1=b.i1 join tbl3 c on a.i1=c.i1 join tbl4 d on a.i1=d.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from tbl1 join tbl2 on tbl1.i1=tbl2.i1 join tbl3 on tbl2.i1=tbl3.i1 join tbl4 on tbl3.i1=tbl4.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select * from tbl1 a join tbl2 b on a.i1=b.i1 join tbl3 c on b.i1=c.i1 join tbl4 d on c.i1=d.i1;
|
||||
--enable_result_log
|
||||
select * from tbl1 left join tbl2 on tbl1.i1=tbl2.i1 left join tbl3 on tbl1.i1=tbl3.i1 left join tbl4 on tbl1.i1=tbl4.i1;
|
||||
select * from tbl1 a left join tbl2 b on a.i1=b.i1 left join tbl3 c on a.i1=c.i1 left join tbl4 d on a.i1=d.i1;
|
||||
select * from tbl1 left join tbl2 on tbl1.i1=tbl2.i1 left join tbl3 on tbl1.i1=tbl3.i1 left join tbl4 on tbl1.i1=tbl4.i1 where tbl1.i1=1;
|
||||
select * from tbl1 left join tbl2 on tbl1.i1=tbl2.i1 left join tbl3 on tbl2.i1=tbl3.i1 left join tbl4 on tbl3.i1=tbl4.i1;
|
||||
select * from tbl1 a left join tbl2 b on a.i1=b.i1 left join tbl3 c on b.i1=c.i1 left join tbl4 d on c.i1=d.i1;
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select* from tbl1 left join tbl2 on tbl1.i1=tbl2.i1 left join tbl3 on tbl1.i1=tbl3.i1 left join tbl4 on tbl1.i1=tbl4.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select* from tbl1 a left join tbl2 b on a.i1=b.i1 left join tbl3 c on a.i1=c.i1 left join tbl4 d on a.i1=d.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select* from tbl1 left join tbl2 on tbl1.i1=tbl2.i1 left join tbl3 on tbl2.i1=tbl3.i1 left join tbl4 on tbl3.i1=tbl4.i1;
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
--disable_result_log
|
||||
explain select* from tbl1 a left join tbl2 b on a.i1=b.i1 left join tbl3 c on b.i1=c.i1 left join tbl4 d on c.i1=d.i1;
|
||||
--enable_result_log
|
||||
36
tools/deploy/mysql_test/t/join_using1.test
Normal file
36
tools/deploy/mysql_test/t/join_using1.test
Normal file
@ -0,0 +1,36 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL1
|
||||
# tags: join
|
||||
# description:
|
||||
# join using case
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tjuo1,tjuo2,tjuo3;
|
||||
--enable_warnings
|
||||
create table tjuo1 (pk int,c1 int, primary key(pk));
|
||||
create table tjuo2 (pk int,c1 int, c2 int, primary key(pk));
|
||||
create table tjuo3 (pk int,c2 int, primary key(pk));
|
||||
insert into tjuo1 values(1, 11), (2, 12), (3, 13);
|
||||
insert into tjuo2 values(4, 11, 21), (5, 12, 22), (6, 13, 23);
|
||||
insert into tjuo3 values(7, 21), (8, 22), (9, 23);
|
||||
select * from tjuo1;
|
||||
select * from tjuo2;
|
||||
select * from tjuo3;
|
||||
|
||||
#2T
|
||||
SELECT * FROM tjuo1 JOIN (SELECT * FROM tjuo2) as tjuo2_alias on tjuo1.c1= tjuo2_alias.c1;
|
||||
SELECT * FROM tjuo1 RIGHT JOIN (SELECT * FROM tjuo2) as tjuo2_alias USING (c1);
|
||||
|
||||
#3T
|
||||
SELECT * FROM tjuo1 JOIN tjuo2 on tjuo1.c1=tjuo2.c1 JOIN tjuo3 on tjuo2.c2=tjuo3.c2;
|
||||
SELECT * FROM tjuo1 RIGHT JOIN tjuo2 USING (c1) RIGHT JOIN tjuo3 USING (c2);
|
||||
SELECT * FROM tjuo1 RIGHT JOIN (SELECT * FROM tjuo2) as tjuo2_alias USING (c1) RIGHT JOIN tjuo3 USING (c2);
|
||||
SELECT * FROM (SELECT * FROM tjuo1) tjuo1_alias RIGHT JOIN (SELECT * FROM tjuo2) as tjuo2_alias USING (c1) RIGHT JOIN (SELECT * FROM tjuo3) as tjuo3_alias USING (c2);
|
||||
SELECT * FROM (SELECT * FROM tjuo1) tjuo1_alias RIGHT JOIN tjuo2 USING (c1) RIGHT JOIN (SELECT * FROM tjuo3) as tjuo3_alias USING (c2);
|
||||
SELECT * FROM (SELECT c2 FROM tjuo1 as i1 JOIN (SELECT * FROM tjuo2) as i2 USING (c1) ) as t12 RIGHT JOIN (SELECT * FROM tjuo3) as tjuo3_alias USING (c2);
|
||||
SELECT * FROM (SELECT c2 FROM tjuo1 as i1 JOIN (SELECT * FROM tjuo2) as i2 USING (c1) ) as t12;
|
||||
drop table tjuo1, tjuo2, tjuo3;
|
||||
83
tools/deploy/mysql_test/t/jp_length_utf8.test
Normal file
83
tools/deploy/mysql_test/t/jp_length_utf8.test
Normal file
@ -0,0 +1,83 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL3
|
||||
# description: foobar
|
||||
|
||||
#--source include/have_utf8.inc
|
||||
#--source include/have_innodb.inc
|
||||
#--disable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists `T1`;
|
||||
drop table if exists `T2`;
|
||||
drop table if exists `T3`;
|
||||
drop table if exists `T4`;
|
||||
drop table if exists `T5`;
|
||||
drop table if exists `T6`;
|
||||
drop table if exists `T7`;
|
||||
drop table if exists `T8`;
|
||||
drop table if exists `T9`;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Test LENGTH() function with Japanese character in utf8 encoding
|
||||
#
|
||||
|
||||
SET NAMES utf8;
|
||||
#SET character_set_database = utf8;
|
||||
|
||||
CREATE TABLE `T1` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T2` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T3` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T4` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T5` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T6` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T7` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T8` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `T9` (`C1` char(5) PRIMARY KEY, INDEX(`C1`)) DEFAULT CHARSET = utf8;
|
||||
|
||||
INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
|
||||
INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
|
||||
INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
|
||||
INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
|
||||
INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
|
||||
INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
|
||||
INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
|
||||
INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
|
||||
INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
|
||||
|
||||
SELECT * FROM `T1`;
|
||||
SELECT * FROM `T2`;
|
||||
SELECT * FROM `T3`;
|
||||
SELECT * FROM `T4`;
|
||||
SELECT * FROM `T5`;
|
||||
SELECT * FROM `T6`;
|
||||
SELECT * FROM `T7`;
|
||||
SELECT * FROM `T8`;
|
||||
SELECT * FROM `T9`;
|
||||
|
||||
#InnoDB
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T1`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T2`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T3`;
|
||||
|
||||
#MyISAM
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T4`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T5`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T6`;
|
||||
|
||||
#MEMORY
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T7`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T8`;
|
||||
SELECT `C1`, LENGTH(`C1`) FROM `T9`;
|
||||
|
||||
DROP TABLE `T1`;
|
||||
DROP TABLE `T2`;
|
||||
DROP TABLE `T3`;
|
||||
DROP TABLE `T4`;
|
||||
DROP TABLE `T5`;
|
||||
DROP TABLE `T6`;
|
||||
DROP TABLE `T7`;
|
||||
DROP TABLE `T8`;
|
||||
DROP TABLE `T9`;
|
||||
21
tools/deploy/mysql_test/t/largetimeout.test
Normal file
21
tools/deploy/mysql_test/t/largetimeout.test
Normal file
@ -0,0 +1,21 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
set @@ob_query_timeout=3599999999999999963;
|
||||
select @@ob_query_timeout;
|
||||
set @@ob_query_timeout=3216672000000000;
|
||||
select @@ob_query_timeout;
|
||||
set @@ob_query_timeout=3216672000000001;
|
||||
select @@ob_query_timeout;
|
||||
set @@ob_query_timeout=3216671999999999;
|
||||
select @@ob_query_timeout;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int primary key ,b int);
|
||||
desc t1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
40
tools/deploy/mysql_test/t/limit.test
Normal file
40
tools/deploy/mysql_test/t/limit.test
Normal file
@ -0,0 +1,40 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_abort_on_error
|
||||
#
|
||||
# Test of update and delete with limit
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a int primary key,b int);
|
||||
|
||||
insert into t1(a) values(1),(2),(3);
|
||||
select * from t1 limit 0;
|
||||
select * from t1 limit 1;
|
||||
select * from t1 limit 3;
|
||||
select * from t1 limit 4;
|
||||
|
||||
# netsed limit,用来测试limit算子自身的re_est_cost(...)函数
|
||||
select /*+no_rewrite*/ * from (select * from t1 order by b limit 4) AS t2 limit 2;
|
||||
|
||||
#--error 1146
|
||||
select * from t1 limit -1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
create table t1 (a int primary key,b int);
|
||||
insert into t1(a) values (1),(2),(3),(4),(5),(6),(7);
|
||||
select * FROM t1 ORDER BY a desc LIMIT 3;
|
||||
select * FROM t1 ORDER BY a desc LIMIT 0;
|
||||
select * FROM t1 ORDER BY a desc LIMIT 8;
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
drop table t1;
|
||||
19
tools/deploy/mysql_test/t/ms_lose_rollback.test
Normal file
19
tools/deploy/mysql_test/t/ms_lose_rollback.test
Normal file
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL3
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--disable_abort_on_error
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
insert into t1 values(1,1);
|
||||
set autocommit=0;
|
||||
insert into t1 values(1,1);
|
||||
rollback;
|
||||
insert into t1 values(1,1);
|
||||
rollback;
|
||||
29
tools/deploy/mysql_test/t/non_reserved_keyword.test
Normal file
29
tools/deploy/mysql_test/t/non_reserved_keyword.test
Normal file
@ -0,0 +1,29 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: dml
|
||||
# description:
|
||||
#
|
||||
#alter system set balance_worker_idle_sleep_seconds=33 COMMENT 'new all balance_worker_idle_sleep_seconds' SERVer_TYPE = ROOTSERVER cluster = 0;
|
||||
|
||||
#alter system set balance_worker_idle_sleep_seconds=39 COMMENT 'new1 root balance_worker_idle_sleep_seconds' SERVer_TYPE = ROOTSERVER server_ip = '10.235.162.3' server_port = 47051;
|
||||
|
||||
create table t_status(id int primary key, chunkserver char(90), mergesrver char(90), rootserver char(90), updateserver char(90), tablet_max_size int, status int);
|
||||
|
||||
insert into t_status(id, chunkserver, tablet_max_size, status) values(1, 'chunkserver', 1024, 0);
|
||||
|
||||
select id, chunkserver, status from t_status;
|
||||
|
||||
select id, chunkserver, status as verbose from t_status;
|
||||
|
||||
select id, chunkserver, grants.status as verbose from t_status grants;
|
||||
|
||||
--error 1064
|
||||
select use_bloom_filter() from dual;
|
||||
|
||||
--error 1305
|
||||
select use_bloom() from dual;
|
||||
|
||||
drop table t_status;
|
||||
32
tools/deploy/mysql_test/t/outer_join_where_is_null.test
Normal file
32
tools/deploy/mysql_test/t/outer_join_where_is_null.test
Normal file
@ -0,0 +1,32 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: join
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id smallint NOT NULL,
|
||||
name varchar(60) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,'Antonio Paz');
|
||||
INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
|
||||
INSERT INTO t1 VALUES (3,'Thimble Smith');
|
||||
|
||||
CREATE TABLE t2 (
|
||||
id smallint NOT NULL,
|
||||
owner smallint DEFAULT '0' NOT NULL,
|
||||
name varchar(60),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO t2 VALUES (1,1,'El Gato');
|
||||
INSERT INTO t2 VALUES (2,1,'Perrito');
|
||||
INSERT INTO t2 VALUES (3,3,'Happy');
|
||||
|
||||
select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
|
||||
102
tools/deploy/mysql_test/t/parallel_insert.test
Normal file
102
tools/deploy/mysql_test/t/parallel_insert.test
Normal file
@ -0,0 +1,102 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
set transaction_isolation='READ-COMMITTED';
|
||||
set tx_isolation='READ-COMMITTED';
|
||||
--enable_query_log
|
||||
#owner: yuchen.wyc
|
||||
#owner group: sql1
|
||||
|
||||
####test:two trx on one rows,one trx rollback
|
||||
connect (conn0,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--enable_sorted_result
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
--enable_sorted_result
|
||||
|
||||
connection conn0;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(pk int primary key, c1 int);
|
||||
create index idx on t1(c1);
|
||||
insert into t1 values(6,6),(7,7),(8,8);
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
|
||||
connection conn1;
|
||||
set autocommit=0;
|
||||
|
||||
connection conn2;
|
||||
set autocommit=0;
|
||||
|
||||
####insert +insert
|
||||
connection conn1;
|
||||
insert into t1 values(1,1);
|
||||
|
||||
connection conn2;
|
||||
sleep 1;
|
||||
send insert into t1 values(1,11);
|
||||
|
||||
connection conn1;
|
||||
sleep 1;
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
--error 1062
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
|
||||
####insert +replace
|
||||
connection conn1;
|
||||
insert into t1 values(2,2);
|
||||
|
||||
connection conn2;
|
||||
sleep 1;
|
||||
send replace into t1 values(2,12);
|
||||
|
||||
connection conn1;
|
||||
sleep 1;
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
|
||||
####replace +insert
|
||||
connection conn1;
|
||||
replace into t1 values(3,3);
|
||||
|
||||
connection conn2;
|
||||
sleep 1;
|
||||
send insert into t1 values(3,13);
|
||||
|
||||
connection conn1;
|
||||
sleep 1;
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
--error 1062
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
|
||||
####replace +replace
|
||||
connection conn1;
|
||||
replace into t1 values(4,4);
|
||||
|
||||
connection conn2;
|
||||
sleep 1;
|
||||
send replace into t1 values(4,14);
|
||||
|
||||
connection conn1;
|
||||
sleep 1;
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
reap;
|
||||
commit;
|
||||
select * from t1;
|
||||
|
||||
drop table t1;
|
||||
315
tools/deploy/mysql_test/t/pk_num_boundary.test
Normal file
315
tools/deploy/mysql_test/t/pk_num_boundary.test
Normal file
@ -0,0 +1,315 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: bin.lb
|
||||
# owner group: SQL2
|
||||
# tags: ddl
|
||||
# description:
|
||||
#
|
||||
## max supported primary key column count 64 - 7 = 57
|
||||
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
create table t1 (
|
||||
c1 int,
|
||||
c2 int,
|
||||
c3 int,
|
||||
c4 int,
|
||||
c5 int,
|
||||
c6 int,
|
||||
c7 int,
|
||||
c8 int,
|
||||
c9 int,
|
||||
c10 int,
|
||||
c11 int,
|
||||
c12 int,
|
||||
c13 int,
|
||||
c14 int,
|
||||
c15 int,
|
||||
c16 int,
|
||||
c17 int,
|
||||
c18 int,
|
||||
c19 int,
|
||||
c20 int,
|
||||
c21 int,
|
||||
c22 int,
|
||||
c23 int,
|
||||
c24 int,
|
||||
c25 int,
|
||||
c26 int,
|
||||
c27 int,
|
||||
c28 int,
|
||||
c29 int,
|
||||
c30 int,
|
||||
c31 int,
|
||||
c32 int,
|
||||
c33 int,
|
||||
c34 int,
|
||||
c35 int,
|
||||
c36 int,
|
||||
c37 int,
|
||||
c38 int,
|
||||
c39 int,
|
||||
c40 int,
|
||||
c41 int,
|
||||
c42 int,
|
||||
c43 int,
|
||||
c44 int,
|
||||
c45 int,
|
||||
c46 int,
|
||||
c47 int,
|
||||
c48 int,
|
||||
c49 int,
|
||||
c50 int,
|
||||
c51 int,
|
||||
c52 int,
|
||||
c53 int,
|
||||
c54 int,
|
||||
c55 int,
|
||||
c56 int,
|
||||
c57 int,
|
||||
c58 int,
|
||||
c59 int,
|
||||
c60 int,
|
||||
c61 int,
|
||||
c62 int,
|
||||
c63 int,
|
||||
c64 int,
|
||||
c65 int,
|
||||
c66 int,
|
||||
c67 int,
|
||||
c68 int,
|
||||
c69 int,
|
||||
c70 int,
|
||||
c71 int,
|
||||
c72 int,
|
||||
c73 int,
|
||||
c74 int,
|
||||
c75 int,
|
||||
c76 int,
|
||||
c77 int,
|
||||
c78 int,
|
||||
c79 int,
|
||||
c80 int,
|
||||
|
||||
primary key(
|
||||
c1,
|
||||
c2,
|
||||
c3,
|
||||
c4,
|
||||
c5,
|
||||
c6,
|
||||
c7,
|
||||
c8,
|
||||
c9,
|
||||
c10,
|
||||
c11,
|
||||
c12,
|
||||
c13,
|
||||
c14,
|
||||
c15,
|
||||
c16,
|
||||
c17,
|
||||
c18,
|
||||
c19,
|
||||
c20,
|
||||
c21,
|
||||
c22,
|
||||
c23,
|
||||
c24,
|
||||
c25,
|
||||
c26,
|
||||
c27,
|
||||
c28,
|
||||
c29,
|
||||
c30,
|
||||
c31,
|
||||
c32,
|
||||
c33,
|
||||
c34,
|
||||
c35,
|
||||
c36,
|
||||
c37,
|
||||
c38,
|
||||
c39,
|
||||
c40,
|
||||
c41,
|
||||
c42,
|
||||
c43,
|
||||
c44,
|
||||
c45,
|
||||
c46,
|
||||
c47,
|
||||
c48,
|
||||
c49,
|
||||
c50,
|
||||
c51,
|
||||
c52,
|
||||
c53,
|
||||
c54,
|
||||
c55,
|
||||
c56,
|
||||
c57
|
||||
)
|
||||
);
|
||||
|
||||
create table t2 (
|
||||
c1 int,
|
||||
c2 int,
|
||||
c3 int,
|
||||
c4 int,
|
||||
c5 int,
|
||||
c6 int,
|
||||
c7 int,
|
||||
c8 int,
|
||||
c9 int,
|
||||
c10 int,
|
||||
c11 int,
|
||||
c12 int,
|
||||
c13 int,
|
||||
c14 int,
|
||||
c15 int,
|
||||
c16 int,
|
||||
c17 int,
|
||||
c18 int,
|
||||
c19 int,
|
||||
c20 int,
|
||||
c21 int,
|
||||
c22 int,
|
||||
c23 int,
|
||||
c24 int,
|
||||
c25 int,
|
||||
c26 int,
|
||||
c27 int,
|
||||
c28 int,
|
||||
c29 int,
|
||||
c30 int,
|
||||
c31 int,
|
||||
c32 int,
|
||||
c33 int,
|
||||
c34 int,
|
||||
c35 int,
|
||||
c36 int,
|
||||
c37 int,
|
||||
c38 int,
|
||||
c39 int,
|
||||
c40 int,
|
||||
c41 int,
|
||||
c42 int,
|
||||
c43 int,
|
||||
c44 int,
|
||||
c45 int,
|
||||
c46 int,
|
||||
c47 int,
|
||||
c48 int,
|
||||
c49 int,
|
||||
c50 int,
|
||||
c51 int,
|
||||
c52 int,
|
||||
c53 int,
|
||||
c54 int,
|
||||
c55 int,
|
||||
c56 int,
|
||||
c57 int,
|
||||
c58 int,
|
||||
c59 int,
|
||||
c60 int,
|
||||
c61 int,
|
||||
c62 int,
|
||||
c63 int,
|
||||
c64 int,
|
||||
c65 int,
|
||||
c66 int,
|
||||
c67 int,
|
||||
c68 int,
|
||||
c69 int,
|
||||
c70 int,
|
||||
c71 int,
|
||||
c72 int,
|
||||
c73 int,
|
||||
c74 int,
|
||||
c75 int,
|
||||
c76 int,
|
||||
c77 int,
|
||||
c78 int,
|
||||
c79 int,
|
||||
c80 int,
|
||||
|
||||
primary key(
|
||||
c1,
|
||||
c2,
|
||||
c3,
|
||||
c4,
|
||||
c5,
|
||||
c6,
|
||||
c7,
|
||||
c8,
|
||||
c9,
|
||||
c10,
|
||||
c11,
|
||||
c12,
|
||||
c13,
|
||||
c14,
|
||||
c15,
|
||||
c16,
|
||||
c17,
|
||||
c18,
|
||||
c19,
|
||||
c20,
|
||||
c21,
|
||||
c22,
|
||||
c23,
|
||||
c24,
|
||||
c25,
|
||||
c26,
|
||||
c27,
|
||||
c28,
|
||||
c29,
|
||||
c30,
|
||||
c31,
|
||||
c32,
|
||||
c33,
|
||||
c34,
|
||||
c35,
|
||||
c36,
|
||||
c37,
|
||||
c38,
|
||||
c39,
|
||||
c40,
|
||||
c41,
|
||||
c42,
|
||||
c43,
|
||||
c44,
|
||||
c45,
|
||||
c46,
|
||||
c47,
|
||||
c48,
|
||||
c49,
|
||||
c50,
|
||||
c51,
|
||||
c52,
|
||||
c53,
|
||||
c54,
|
||||
c55,
|
||||
c56,
|
||||
c57,
|
||||
c58
|
||||
)
|
||||
);
|
||||
|
||||
create index i1 on t1 (c80);
|
||||
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
518
tools/deploy/mysql_test/t/range.test
Normal file
518
tools/deploy/mysql_test/t/range.test
Normal file
@ -0,0 +1,518 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: sql4
|
||||
# description:范围查询测试
|
||||
#
|
||||
# Problem with range optimizer
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
event_date datetime DEFAULT '2014-02-22' NOT NULL,
|
||||
obtype int DEFAULT '0' NOT NULL,
|
||||
event_id int DEFAULT '0' NOT NULL,
|
||||
extra int,
|
||||
PRIMARY KEY (event_date,obtype,event_id)
|
||||
);
|
||||
|
||||
INSERT INTO t1(event_date,obtype,event_id) VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
|
||||
('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
|
||||
('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
|
||||
('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
|
||||
('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
|
||||
('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
|
||||
('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
|
||||
('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
|
||||
('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
|
||||
('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
|
||||
('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
|
||||
('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
|
||||
('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
|
||||
('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
|
||||
('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
|
||||
('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
|
||||
('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
|
||||
('1999-09-19',100100,37), ('2000-12-18',100700,38);
|
||||
|
||||
select event_date,obtype,event_id from t1 WHERE event_date >= '1999-07-01' AND event_date < '1999-07-15' AND (obtype=100600 OR obtype=100100) ORDER BY event_date;
|
||||
select event_date,obtype,event_id from t1 WHERE event_date >= '1999-07-01' AND event_date <= '1999-07-15' AND (obtype=100600 OR obtype=100100) or event_date >= '1999-07-01' AND event_date <= '1999-07-15' AND obtype=100099;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
PAPER_ID smallint DEFAULT '0' NOT NULL,
|
||||
YEAR smallint DEFAULT '0' NOT NULL,
|
||||
ISSUE smallint DEFAULT '0' NOT NULL,
|
||||
CLOSED tinyint DEFAULT '0' NOT NULL,
|
||||
ISS_DATE datetime DEFAULT '2014-02-22' NOT NULL,
|
||||
PRIMARY KEY (PAPER_ID,YEAR,ISSUE)
|
||||
);
|
||||
INSERT INTO t1 VALUES (3,1999,34,0,'1999-07-12'), (1,1999,111,0,'1999-03-23'),
|
||||
(1,1999,222,0,'1999-03-23'), (3,1999,33,0,'1999-07-12'),
|
||||
(3,1999,32,0,'1999-07-12'), (3,1999,31,0,'1999-07-12'),
|
||||
(3,1999,30,0,'1999-07-12'), (3,1999,29,0,'1999-07-12'),
|
||||
(3,1999,28,0,'1999-07-12'), (1,1999,40,1,'1999-05-01'),
|
||||
(1,1999,41,1,'1999-05-01'), (1,1999,42,1,'1999-05-01'),
|
||||
(1,1999,46,1,'1999-05-01'), (1,1999,47,1,'1999-05-01'),
|
||||
(1,1999,48,1,'1999-05-01'), (1,1999,49,1,'1999-05-01'),
|
||||
(1,1999,50,0,'1999-05-01'), (1,1999,51,0,'1999-05-01'),
|
||||
(1,1999,200,0,'1999-06-28'), (1,1999,52,0,'1999-06-28'),
|
||||
(1,1999,53,0,'1999-06-28'), (1,1999,54,0,'1999-06-28'),
|
||||
(1,1999,55,0,'1999-06-28'), (1,1999,56,0,'1999-07-01'),
|
||||
(1,1999,57,0,'1999-07-01'), (1,1999,58,0,'1999-07-01'),
|
||||
(1,1999,59,0,'1999-07-01'), (1,1999,60,0,'1999-07-01'),
|
||||
(3,1999,35,0,'1999-07-12');
|
||||
select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28)) order by YEAR,ISSUE;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int NOT NULL auto_increment,
|
||||
parent_id int DEFAULT '0' NOT NULL,
|
||||
`level` tinyint DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,0,0), (3,1,1), (4,1,1), (8,2,2), (9,2,2), (17,3,2),
|
||||
(22,4,2), (24,4,2), (28,5,2), (29,5,2), (30,5,2), (31,6,2), (32,6,2), (33,6,2),
|
||||
(203,7,2), (202,7,2), (20,3,2), (157,0,0), (193,5,2), (40,7,2), (2,1,1),
|
||||
(15,2,2), (6,1,1), (34,6,2), (35,6,2), (16,3,2), (7,1,1), (36,7,2), (18,3,2),
|
||||
(26,5,2), (27,5,2), (183,4,2), (38,7,2), (25,5,2), (37,7,2), (21,4,2),
|
||||
(19,3,2), (5,1,1), (179,5,2);
|
||||
SELECT * FROM t1 WHERE `level` = 1 AND parent_id = 1;
|
||||
# The following select returned 0 rows in 3.23.8
|
||||
SELECT * FROM t1 WHERE `level` = 1 AND parent_id = 1 order by id;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing of bug in range optimizer with many key parts and > and <
|
||||
#
|
||||
|
||||
create table t1(
|
||||
Satellite varchar(25) not null,
|
||||
SensorMode varchar(25) not null,
|
||||
FullImageCornersUpperLeftLongitude double not null,
|
||||
FullImageCornersUpperRightLongitude double not null,
|
||||
FullImageCornersUpperRightLatitude double not null,
|
||||
FullImageCornersLowerRightLatitude double not null,
|
||||
primary key(Satellite,SensorMode));
|
||||
|
||||
insert into t1 values('OV-3','PAN1',91,-92,40,50);
|
||||
insert into t1 values('OV-4','PAN1',91,-92,40,50);
|
||||
|
||||
select * from t1 where t1.Satellite = 'OV-3' and t1.SensorMode = 'PAN1' and t1.FullImageCornersUpperLeftLongitude > -90.000000 and t1.FullImageCornersUpperRightLongitude < -82.000000;
|
||||
drop table t1;
|
||||
|
||||
create table t1 ( aString char(100) not null default '', primary key (aString) , extra char(100));
|
||||
insert into t1 (aString) values ( 'believe in myself' ), ( 'believe' ), ('baaa' ), ( 'believe in love');
|
||||
select * from t1 where aString < 'believe in myself' order by aString;
|
||||
select * from t1 where aString > 'believe in love' order by aString;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Problem with binary strings
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
t1ID int NOT NULL ,
|
||||
art binary(1) NOT NULL default '',
|
||||
KNR char(5) NOT NULL default '',
|
||||
RECHNR char(6) NOT NULL default '',
|
||||
POSNR char(2) NOT NULL default '',
|
||||
ARTNR char(10) NOT NULL default '',
|
||||
TEX char(70) NOT NULL default '',
|
||||
PRIMARY KEY (t1ID)
|
||||
);
|
||||
|
||||
INSERT INTO t1 (t1ID,art) VALUES
|
||||
(0,'j'),
|
||||
(1,'J'),
|
||||
(2,'J'),
|
||||
(3,'j'),
|
||||
(4,'J'),
|
||||
(5,'J'),
|
||||
(6,'j'),
|
||||
(7,'J'),
|
||||
(8,'J'),
|
||||
(9,'j'),
|
||||
(10,'J'),
|
||||
(11,'J'),
|
||||
(12,'j'),
|
||||
(13,'J'),
|
||||
(14,'J'),
|
||||
(15,'j'),
|
||||
(16,'J'),
|
||||
(17,'J'),
|
||||
(18,'j'),
|
||||
(19,'J'),
|
||||
(20,'J'),
|
||||
(21,'j'),
|
||||
(22,'J'),
|
||||
(23,'J'),
|
||||
(24,'j'),
|
||||
(25,'J'),
|
||||
(26,'J'),
|
||||
(27,'j'),
|
||||
(28,'J'),
|
||||
(29,'J'),
|
||||
(30,'j'),
|
||||
(31,'J'),
|
||||
(32,'J'),
|
||||
(33,'j'),
|
||||
(34,'J'),
|
||||
(35,'J'),
|
||||
(36,'j'),
|
||||
(37,'J'),
|
||||
(38,'J'),
|
||||
(39,'j'),
|
||||
(40,'J'),
|
||||
(41,'J'),
|
||||
(42,'j'),
|
||||
(43,'J'),
|
||||
(44,'J'),
|
||||
(45,'j'),
|
||||
(46,'J'),
|
||||
(47,'J'),
|
||||
(48,'j'),
|
||||
(49,'J'),
|
||||
(50,'J'),
|
||||
(51,'j'),
|
||||
(52,'J'),
|
||||
(53,'J'),
|
||||
(54,'j'),
|
||||
(55,'J'),
|
||||
(56,'J'),
|
||||
(57,'j'),
|
||||
(58,'J'),
|
||||
(59,'J'),
|
||||
(60,'j'),
|
||||
(61,'J'),
|
||||
(62,'J'),
|
||||
(63,'j'),
|
||||
(64,'J'),
|
||||
(65,'J'),
|
||||
(66,'j'),
|
||||
(67,'J'),
|
||||
(68,'J'),
|
||||
(69,'j'),
|
||||
(70,'J'),
|
||||
(71,'J'),
|
||||
(72,'j'),
|
||||
(73,'J'),
|
||||
(74,'J'),
|
||||
(75,'j'),
|
||||
(76,'J'),
|
||||
(77,'J'),
|
||||
(78,'j'),
|
||||
(79,'J'),
|
||||
(80,'J'),
|
||||
(81,'j'),
|
||||
(82,'J'),
|
||||
(83,'J'),
|
||||
(84,'j'),
|
||||
(85,'J'),
|
||||
(86,'J'),
|
||||
(87,'j'),
|
||||
(88,'J'),
|
||||
(89,'J'),
|
||||
(90,'j'),
|
||||
(91,'J'),
|
||||
(92,'J'),
|
||||
(93,'j'),
|
||||
(94,'J'),
|
||||
(95,'J'),
|
||||
(96,'j'),
|
||||
(97,'J'),
|
||||
(98,'J'),
|
||||
(99,'j'),
|
||||
(100,'J'),
|
||||
(101,'J'),
|
||||
(102,'j'),
|
||||
(103,'J'),
|
||||
(104,'J'),
|
||||
(105,'j'),
|
||||
(106,'J'),
|
||||
(107,'J'),
|
||||
(108,'j'),
|
||||
(109,'J'),
|
||||
(110,'J'),
|
||||
(111,'j'),
|
||||
(112,'J'),
|
||||
(113,'J'),
|
||||
(114,'j'),
|
||||
(115,'J'),
|
||||
(116,'J'),
|
||||
(117,'j'),
|
||||
(118,'J'),
|
||||
(119,'J'),
|
||||
(120,'j'),
|
||||
(121,'J'),
|
||||
(122,'J'),
|
||||
(123,'j'),
|
||||
(124,'J'),
|
||||
(125,'J'),
|
||||
(126,'j'),
|
||||
(127,'J'),
|
||||
(128,'J'),
|
||||
(129,'j'),
|
||||
(130,'J'),
|
||||
(131,'J'),
|
||||
(132,'j'),
|
||||
(133,'J'),
|
||||
(134,'J'),
|
||||
(135,'j'),
|
||||
(136,'J'),
|
||||
(137,'J'),
|
||||
(138,'j'),
|
||||
(139,'J'),
|
||||
(140,'J'),
|
||||
(141,'j'),
|
||||
(142,'J'),
|
||||
(143,'J'),
|
||||
(144,'j'),
|
||||
(145,'J'),
|
||||
(146,'J'),
|
||||
(147,'j'),
|
||||
(148,'J'),
|
||||
(149,'J'),
|
||||
(150,'j'),
|
||||
(151,'J'),
|
||||
(152,'J'),
|
||||
(153,'j'),
|
||||
(154,'J'),
|
||||
(155,'J'),
|
||||
(156,'j'),
|
||||
(157,'J'),
|
||||
(158,'J'),
|
||||
(159,'j'),
|
||||
(160,'J'),
|
||||
(161,'J'),
|
||||
(162,'j'),
|
||||
(163,'J'),
|
||||
(164,'J'),
|
||||
(165,'j'),
|
||||
(166,'J'),
|
||||
(167,'J'),
|
||||
(168,'j'),
|
||||
(169,'J'),
|
||||
(170,'J'),
|
||||
(171,'j'),
|
||||
(172,'J'),
|
||||
(173,'J'),
|
||||
(174,'j'),
|
||||
(175,'J'),
|
||||
(176,'J'),
|
||||
(177,'j'),
|
||||
(178,'J'),
|
||||
(179,'J'),
|
||||
(180,'j'),
|
||||
(181,'J'),
|
||||
(182,'J'),
|
||||
(183,'j'),
|
||||
(184,'J'),
|
||||
(185,'J'),
|
||||
(186,'j'),
|
||||
(187,'J'),
|
||||
(188,'J'),
|
||||
(189,'j'),
|
||||
(190,'J'),
|
||||
(191,'J'),
|
||||
(192,'j'),
|
||||
(193,'J'),
|
||||
(194,'J'),
|
||||
(195,'j'),
|
||||
(196,'J'),
|
||||
(197,'J'),
|
||||
(198,'j'),
|
||||
(199,'J');
|
||||
select count(*) from t1 where upper(art) = 'J';
|
||||
select count(*) from t1 where art = 'J' or art = 'j';
|
||||
select count(*) from t1 where art = 'j' or art = 'J';
|
||||
select count(*) from t1 where art = 'j';
|
||||
select count(*) from t1 where art = 'J';
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
primary key(a,b)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO t1(a,b) VALUES
|
||||
(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),
|
||||
(13,2),(14,2),(15,2),(16,2),(17,3),(16,3),(19,3),(20,3),
|
||||
(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),
|
||||
(33,5),(34,5),(35,5);
|
||||
|
||||
# we expect that optimizer will choose index on A
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test of problem with IN on many different keyparts. (Bug #4157)
|
||||
#
|
||||
create table t1(c1 varchar(1024),c2 varchar(1024), c3 varchar(1024), primary key(c1,c2,c3), extra varchar(1024));
|
||||
insert into t1(c1,c2,c3) values ('s1_1','s1_2','s1_3'),('s2_1','s2_2','s2_3');
|
||||
select * from t1 where c1 in ('s1_1','s2_1') and c2 in ('s2_1','s1_2');
|
||||
drop table t1;
|
||||
|
||||
|
||||
create table t2 (x bigint not null primary key, y bigint);
|
||||
insert into t2(x) values (-16);
|
||||
insert into t2(x) values (-15);
|
||||
select * from t2;
|
||||
select count(*) from t2 where x>0;
|
||||
select count(*) from t2 where x=0;
|
||||
select count(*) from t2 where x<0;
|
||||
select count(*) from t2 where x < -16;
|
||||
select count(*) from t2 where x = -16;
|
||||
select count(*) from t2 where x > -16;
|
||||
select count(*) from t2 where x = 1844674407370955160;
|
||||
drop table t2;
|
||||
|
||||
# BUG#26624 high mem usage (crash) in range optimizer (depends on order of fields in where)
|
||||
create table t1 (
|
||||
c1 char(10) primary key, c2 char(10), c3 char(10), c4 char(10),
|
||||
c5 char(10), c6 char(10), c7 char(10), c8 char(10),
|
||||
c9 char(10), c10 char(10), c11 char(10), c12 char(10),
|
||||
c13 char(10), c14 char(10), c15 char(10), c16 char(10)
|
||||
);
|
||||
insert into t1 (c1) values ('1');
|
||||
|
||||
# This must run without crash and fast:
|
||||
select * from t1 where
|
||||
c1 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c2 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c3 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c4 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c5 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c6 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c7 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c8 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c9 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC')
|
||||
and c10 in ('abcdefgh', '123456789', 'qwertyuio', 'asddfgh',
|
||||
'abcdefg1', '123456781', 'qwertyui1', 'asddfg1',
|
||||
'abcdefg2', '123456782', 'qwertyui2', 'asddfg2',
|
||||
'abcdefg3', '123456783', 'qwertyui3', 'asddfg3',
|
||||
'abcdefg4', '123456784', 'qwertyui4', 'asddfg4',
|
||||
'abcdefg5', '123456785', 'qwertyui5', 'asddfg5',
|
||||
'abcdefg6', '123456786', 'qwertyui6', 'asddfg6',
|
||||
'abcdefg7', '123456787', 'qwertyui7', 'asddfg7',
|
||||
'abcdefg8', '123456788', 'qwertyui8', 'asddfg8',
|
||||
'abcdefg9', '123456789', 'qwertyui9', 'asddfg9',
|
||||
'abcdefgA', '12345678A', 'qwertyuiA', 'asddfgA',
|
||||
'abcdefgB', '12345678B', 'qwertyuiB', 'asddfgB',
|
||||
'abcdefgC', '12345678C', 'qwertyuiC', 'asddfgC');
|
||||
drop table t1;
|
||||
65
tools/deploy/mysql_test/t/rename_table2.test
Normal file
65
tools/deploy/mysql_test/t/rename_table2.test
Normal file
@ -0,0 +1,65 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop database if exists hualong;
|
||||
--enable_warnings
|
||||
create database hualong;
|
||||
use hualong;
|
||||
--disable_warnings
|
||||
drop table if exists r1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists r2;
|
||||
--enable_warnings
|
||||
create table hualong.r1(c1 int not null primary key, c2 int);
|
||||
create table hualong.r2(a int not null primary key , b int);
|
||||
--error 1050
|
||||
rename table r1 to r2;
|
||||
--error 1050
|
||||
alter table r1 rename to r2;
|
||||
--error 1050
|
||||
rename table r1 to r3, r2 to r3;
|
||||
--error 1050
|
||||
rename table r1 to r3, r1 to r3;
|
||||
--error 1017
|
||||
rename table r1 to r3, r1 to r4;
|
||||
#表xx不存在, ti存在, 先报ti存在
|
||||
--error 1050
|
||||
rename table xx to r1;
|
||||
--error 1049
|
||||
rename table xx to a.xxx;
|
||||
rename table r1 to table1, table1 to r1;
|
||||
rename table r1 to r3, r2 to r1;
|
||||
--error 1050
|
||||
rename table r3 to r3;
|
||||
--disable_warnings
|
||||
drop database if exists hualong2;
|
||||
--enable_warnings
|
||||
create database hualong2;
|
||||
rename table hualong.r1 to hualong2.r1;
|
||||
show tables from hualong;
|
||||
show tables from hualong2;
|
||||
|
||||
create index idx1 on hualong.r3(c1);
|
||||
rename table hualong.r3 to hualong2.r2;
|
||||
show tables from hualong;
|
||||
show tables from hualong2;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
show index from hualong2.r2;
|
||||
rename table hualong2.r2 to hualong.r2;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
show index from hualong.r2;
|
||||
show tables from hualong;
|
||||
|
||||
rename table hualong2.r1 to hualong.r1;
|
||||
rename table r1 to tmp, tmp to r1, r2 to tmp;
|
||||
show tables from hualong;
|
||||
|
||||
drop table hualong.r1, hualong.tmp;
|
||||
drop database hualong;
|
||||
drop database hualong2;
|
||||
62
tools/deploy/mysql_test/t/safe_null_test.test
Normal file
62
tools/deploy/mysql_test/t/safe_null_test.test
Normal file
@ -0,0 +1,62 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--disable_warnings
|
||||
set @@recyclebin = off;
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(pk1 int, pk2 int, pk3 int, extra int, d int primary key);
|
||||
|
||||
insert into t1(pk1,pk2,pk3,d) values(1,1,1,1),(2,2,2,2);
|
||||
select * from t1;
|
||||
|
||||
insert into t1 values(3,null,null,NULL,3),(null,null,null,null,4);
|
||||
select * from t1;
|
||||
|
||||
|
||||
select * from t1 where extra = NULL;
|
||||
select * from t1 where extra != NULL;
|
||||
select * from t1 where extra <=> null;
|
||||
select * from t1 where extra is not NULL;
|
||||
select * from t1 where pk1 <=> null and pk2 <=> null and pk3 <=> null;
|
||||
select * from t1 where pk1 = NULL and pk3 = NULL and pk3 = NULL;
|
||||
select * from t1 where pk1 != NULL and pk2 != NULL and pk3 != NULL;
|
||||
select * from t1 where pk1 is not NULL and pk2 is not NULL and pk3 is not NULL;
|
||||
select * from t1 where pk1 in (NULL) and pk2 in (NULL) and pk3 in (NULL);
|
||||
select * from t1 where pk1 in (NULL,1) and pk2 in (NULL, 1);
|
||||
|
||||
update t1 set extra=4 where pk1 = NULL and pk2 = NULL and pk3 = NULL;
|
||||
select * from t1;
|
||||
update t1 set extra=1 where pk1 <=> null;
|
||||
select * from t1;
|
||||
update t1 set extra=2 where pk1 <=> null and pk2 <=> null and pk3 <=> null;
|
||||
select * from t1;
|
||||
update t1 set extra=3 where pk1 is not NULL;
|
||||
select * from t1;
|
||||
update t1 set extra=4 where pk1 is not NULL and pk2 is not NULL and pk3 is not NULL;
|
||||
select * from t1;
|
||||
update t1 set extra=5 where pk1 != NULL;
|
||||
select * from t1;
|
||||
update t1 set extra=6 where pk1 != NULL and pk2 != NULL and pk3 != NULL;
|
||||
select * from t1;
|
||||
|
||||
delete from t1 where pk1 != NULL;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 != NULL and pk2 != NULL and pk3 != NULL;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 = NULL and pk2 = NULL and pk3 = NULL;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 <=> null;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 <=> null and pk2 <=> null and pk3 <=> null;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 is not NULL and pk2 is not NULL and pk3 is not NULL;
|
||||
select * from t1;
|
||||
delete from t1 where pk1 is not NULL;
|
||||
select * from t1;
|
||||
set @@recyclebin = off;
|
||||
drop table t1;
|
||||
207
tools/deploy/mysql_test/t/select_basic.test
Normal file
207
tools/deploy/mysql_test/t/select_basic.test
Normal file
@ -0,0 +1,207 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
#
|
||||
## Bug
|
||||
#
|
||||
# partition by key()
|
||||
--disable_warnings
|
||||
drop database if exists db1;
|
||||
drop database if exists db2;
|
||||
create database db1;
|
||||
create database db2;
|
||||
use db1;
|
||||
drop table if exists t1;
|
||||
create table t1(c1 int key) partition by key() partitions 2;
|
||||
--enable_warnings
|
||||
use db2;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int key) partition by key() partitions 2;
|
||||
select * from db1.t1,db2.t1;
|
||||
# partition by key(expr)
|
||||
use db1;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create table t1(c1 int key) partition by key(c1) partitions 2;
|
||||
create database if not exists db2;
|
||||
use db2;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int key) partition by key(c1) partitions 2;
|
||||
select * from db1.t1,db2.t1;
|
||||
# partition by hash(expr)
|
||||
use db1;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create table t1(c1 int key) partition by hash(c1) partitions 2;
|
||||
create database if not exists db2;
|
||||
--enable_warnings
|
||||
use db2;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int key) partition by hash(c1) partitions 2;
|
||||
select * from db1.t1,db2.t1;
|
||||
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int primary key, c2 int);
|
||||
insert into t1 values(1,8), (2,7), (3,6), (4,5);
|
||||
--error 1054
|
||||
select c1 from t1 group by t2.c1;
|
||||
--error 1052
|
||||
select c1, c2 as c1 from t1 group by c1;
|
||||
--sorted_result
|
||||
select c1, c2 as c1 from t1 group by t1.c1;
|
||||
--error 1052
|
||||
select c1 as c1, c2 as c1 from t1 group by c1;
|
||||
--sorted_result
|
||||
select c1 as c1, c2 as c1 from t1 group by t1.c1;
|
||||
--sorted_result
|
||||
select t1.c1 as cc from t1 group by t1.c1;
|
||||
--sorted_result
|
||||
select c1, c1 from t1 group by c1;
|
||||
select 1 as c1, 2 as c2 from t1 group by c1;
|
||||
--error 1052
|
||||
select 1 as c1, c1 from t1 group by c1;
|
||||
--disable_warnings
|
||||
select c1 as c2, c2 as c1 from t1 group by c1;
|
||||
--error 1052
|
||||
select c2+1 as c1, c1 from t1 group by c1;
|
||||
--enable_warnings
|
||||
select c1, c2 as c1 from t1 having t1.c1 > 2;
|
||||
select c1, c2 + 1 as c1 from t1 having t1.c1 > 2;
|
||||
--error 1052
|
||||
select c1, c2 + 1 as c1 from t1 having c1 > 2;
|
||||
--error 1052
|
||||
select c1, c2 + 1 as c1 from t1 order by c1;
|
||||
select c1, c2 + 1 as c1 from t1 order by t1.c1;
|
||||
--disable_warnings
|
||||
--error 1052
|
||||
select c1, c2 + 1 as c1 from t1 group by c1;
|
||||
--sorted_result
|
||||
select c1, c2 + 1 as c1 from t1 group by t1.c1;
|
||||
--enable_warnings
|
||||
select t1.c1 as c1 from t1 order by t1.c1;
|
||||
select t1.c1 as c2 from t1 order by t1.c1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int(11), b char(10), key (a));
|
||||
insert into t1 (a) values (1),(2),(3),(4);
|
||||
create table t2 (a int);
|
||||
select * from t1 left join t2 on t1.a=t2.a order by t1.a;
|
||||
select * from t1 left join t2 on t1.a=t2.a having not (t2.a <=> t1.a) order by t1.a;
|
||||
select exists(( select 1));
|
||||
select exists( select 1);
|
||||
drop table t1,t2;
|
||||
|
||||
create table t1(c1 int, c2 int);
|
||||
insert into t1 values(1, 1), (2, 2);
|
||||
select * from t1 where c1<'2';
|
||||
select * from t1 where c1>'1';
|
||||
select * from t1 where c1='2';
|
||||
select * from t1 where c1!='2';
|
||||
select * from t1 where c1<='2';
|
||||
select * from t1 where c1>='2';
|
||||
select * from t1 where c1+'1'<=3;
|
||||
select * from t1 where c1+'1'>=2;
|
||||
drop table t1;
|
||||
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
insert into t1 values(1, 1), (2, 2);
|
||||
select * from t1 where c1<'2';
|
||||
select * from t1 where c1>'1';
|
||||
select * from t1 where c1='2';
|
||||
select * from t1 where c1!='2';
|
||||
select * from t1 where c1<='2';
|
||||
select * from t1 where c1>='2';
|
||||
select * from t1 where c1+'1'<=3;
|
||||
select * from t1 where c1+'1'>=2;
|
||||
drop table t1;
|
||||
|
||||
##like syntax
|
||||
SELECT 'a' = 'a ', 'a' LIKE 'a ';
|
||||
SELECT 'David!' LIKE 'David_';
|
||||
SELECT 'David!' LIKE '%D%v%';
|
||||
SELECT 'David!' LIKE 'David\_';
|
||||
SELECT 'David_' LIKE 'David\_';
|
||||
SELECT 'David_' LIKE 'David|_' ESCAPE '|';
|
||||
SELECT 'abc' LIKE 'ABC';
|
||||
SELECT 'abc' LIKE BINARY 'ABC';
|
||||
SELECT 10 LIKE '1%';
|
||||
SELECT 'David_' LIKE 'David|_' ESCAPE null;
|
||||
SELECT 'David_' LIKE 'David|_' ESCAPE 1;
|
||||
--error 1210
|
||||
SELECT 'David_' LIKE 'David|_' ESCAPE 12;
|
||||
--error 1210
|
||||
SELECT 'David_' LIKE 'David|_' ESCAPE '12';
|
||||
## alias
|
||||
--disable_warnings
|
||||
drop table if exists a1,a2;
|
||||
--enable_warnings
|
||||
create table a2(rowkey_suffix2 int primary key, price2 int);
|
||||
create table a1(rowkey_suffix int primary key, price int);
|
||||
--error 1064
|
||||
select (select price from a2 where 1000 > price) as 'x', a1.* as 'with_alias' from a1;
|
||||
--error 1064
|
||||
select (select price from a2 where 1000 > price) as 'x', a1.* as with_alias from a1;
|
||||
--error 1241
|
||||
select 1 from dual where @a:=1 and (1, 2);
|
||||
--error 1241
|
||||
select 1 from dual where @a:=1 and (1, (select 2));
|
||||
--error 1241
|
||||
select 1 from dual where @a:=1 and (1, exists(select 2));
|
||||
|
||||
create table t1(c1 int);
|
||||
select 1 from t1 where c1 in (select c1 from t1 where exists( (select 1) union (select 1)));
|
||||
select (1 and 100) or 100;
|
||||
|
||||
drop table t1;
|
||||
create table t1(c1 bigint, c2 varchar(64), c3 datetime);
|
||||
insert into t1 values(20101010000000, '020101010000000', '2010-10-10 00:00:00');
|
||||
select * from t1 where c1=c2 and c1=cast('2010-10-10 00:00:00' as datetime);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists bug;
|
||||
--enable_warnings
|
||||
create table bug (col_float float);
|
||||
insert into bug values(100);
|
||||
select ((col_float and 100) or col_float) from bug;
|
||||
|
||||
drop table t1;
|
||||
create table test1 (id int,dt datetime(6), primary key(id, dt));
|
||||
insert into test1 values (0, '2017-01-01'), (0, '2017-01-02'), (0, '2017-01-03'), (1, '2017-01-01'), (1, '2017-01-02'), (1, '2017-01-03');
|
||||
select * from test1 where (id, dt) > (0, '2017-01-02') and (id, dt) <= (1, '2017-01-03');
|
||||
select * from test1 where (id, dt) > (0, '2017-01-02') and (id, dt) <= (1, '2017-01-03') and dt < '2017-01-02';
|
||||
|
||||
|
||||
#fix a bug :
|
||||
--result_format 4
|
||||
--error 1054
|
||||
select cast '';
|
||||
--error 1054
|
||||
select length '';
|
||||
--error 1054
|
||||
select yearweek '';
|
||||
--error 1054
|
||||
select lala '';
|
||||
select 1 '';
|
||||
select 2 '';
|
||||
select 2 as '';
|
||||
select 1 as '';
|
||||
|
||||
drop database if exists db1;
|
||||
drop database if exists db2;
|
||||
9
tools/deploy/mysql_test/t/selectotherdb.test
Normal file
9
tools/deploy/mysql_test/t/selectotherdb.test
Normal file
@ -0,0 +1,9 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: peihan.dph
|
||||
# owner group: SQL2
|
||||
# description:
|
||||
#
|
||||
--error 1064
|
||||
SELECT name FROM master.dbo.sysdatabases WHERE status <> 512;
|
||||
43
tools/deploy/mysql_test/t/sfu.test
Normal file
43
tools/deploy/mysql_test/t/sfu.test
Normal file
@ -0,0 +1,43 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: linlin.xll
|
||||
#owner group: SQL1
|
||||
#description:
|
||||
#tags: dml, trx
|
||||
|
||||
#show variables like 'ob_query_timeout';
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(pk int primary key, c1 int);
|
||||
insert into t1 values(1,1);
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
|
||||
connection conn1;
|
||||
begin;
|
||||
select * from t1 where pk=1 for update;
|
||||
update t1 set c1=c1+1 where pk=1;
|
||||
|
||||
|
||||
connection conn2;
|
||||
begin;
|
||||
send select * from t1 where t1.pk=1 for update;
|
||||
--real_sleep 2
|
||||
|
||||
connection conn1;
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
reap;
|
||||
update t1 set c1=c1+1 where pk=1;
|
||||
commit;
|
||||
|
||||
|
||||
select * from t1;
|
||||
144
tools/deploy/mysql_test/t/sfu_norow_alias.test
Normal file
144
tools/deploy/mysql_test/t/sfu_norow_alias.test
Normal file
@ -0,0 +1,144 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: sql4
|
||||
# description: ����select for update�������������
|
||||
--disable_query_log
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
sleep 2;
|
||||
--enable_query_log
|
||||
--disable_warnings
|
||||
drop table if exists tbl1,tbl2;
|
||||
--enable_warnings
|
||||
create table tbl1 (pk int,i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3),i6 bool, primary key(pk));
|
||||
####һ�뾲̬���ݣ�һ�붯̬����
|
||||
insert into tbl1 values(1,1,'abc12','1agc',1.25,'2014-01-01 12:00:00',23.23,1),
|
||||
(2,10,'23abc12','4agc1',-0.25,'2015-11-01 12:00:00',-23.230,0),
|
||||
(3,201,'xx23abc12','cagc1',-2.25,'2015-11-21 11:20:10',3.231,1),
|
||||
(4,80,'zx23abc12','zcagc1',2.25,'2013-01-21 11:20:10',-3.231,1),
|
||||
(5,53,'cx23abc12','rcagc1',109.25,'2016-01-22 11:20:10',-13.131,0);
|
||||
#create unique index idx on tbl1(i1);
|
||||
#create unique index idx on tbl1(i4);
|
||||
#create unique index idx on tbl1(i1,v2);
|
||||
--source mysql_test/include/majorfreeze.inc
|
||||
--source mysql_test/include/wait_daily_merge.inc
|
||||
|
||||
insert into tbl1 values (6,78,'tx23abc12','icagc1',-109.25,'2014-09-16 16:24:00',-13.531,1),(8,50,'vx23abc12','wcagc1',-85.85,'2014-09-10 16:20:21',93.131,1),(9,610,'ukx23abc12','pecagc1',-1.85,'2014-09-19 16:20:21',99.131,0),(10,42,'kx23abc12','ecagc1',-85.86,'2014-09-18 16:20:21',-99.131,1),(11,null,null,null,null,null,null,null);
|
||||
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--disable_query_log
|
||||
connection conn1;
|
||||
set session ob_query_timeout = 2000000;
|
||||
set session ob_trx_timeout = 10000000;
|
||||
set session ob_trx_idle_timeout = 5000000;
|
||||
connection conn2;
|
||||
set session ob_query_timeout = 2000000;
|
||||
set session ob_trx_timeout = 10000000;
|
||||
set session ob_trx_idle_timeout = 5000000;
|
||||
--enable_query_log
|
||||
connection conn1;
|
||||
set autocommit=0;
|
||||
|
||||
connection conn2;
|
||||
set autocommit=0;
|
||||
|
||||
####����1 sfuһ������,���ӱ���,����2������У�����1�ٸ��¸��У�
|
||||
connection conn1;
|
||||
#select * from tbl1 a where a.pk=100 for update;
|
||||
#�ĸô������ñ���
|
||||
select * from tbl1 where pk=100 for update;
|
||||
|
||||
|
||||
connection conn2;
|
||||
insert into tbl1 values(100,102,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
update tbl1 set i1=i1-300 where pk in (100,1,123,8,9);
|
||||
|
||||
connection conn1;
|
||||
update tbl1 set pk=200 where pk=100;
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
connection conn2;
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
select * from tbl1 where pk in (100,200);
|
||||
delete from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
####����1 sfuһ������,���ӱ���,����2������У�����1�ٲ�����У�
|
||||
connection conn1;
|
||||
#select * from tbl1 abc where abc.pk=100 for update;
|
||||
select * from tbl1 where pk=100 for update;
|
||||
|
||||
|
||||
connection conn2;
|
||||
insert into tbl1 values(100,102,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
update tbl1 set i1=i1-300 where pk in (100,1,123,8,9);
|
||||
|
||||
connection conn1;
|
||||
--error 1205,4012
|
||||
insert into tbl1 values(100,102,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
connection conn2;
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
select * from tbl1 where pk in (100,200);
|
||||
delete from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
####����1 sfuһ������,�ӱ�����,����2 sfu ͬһ��
|
||||
connection conn1;
|
||||
#select * from tbl1 abc where abc.pk=100 for update;
|
||||
select * from tbl1 where pk=100 for update;
|
||||
|
||||
|
||||
connection conn2;
|
||||
insert into tbl1 values(100,102,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
update tbl1 set i1=i1-300 where pk in (100,1,123,8,9);
|
||||
select * from tbl1 where pk=100 for update;
|
||||
|
||||
connection conn1;
|
||||
--error 1205,4012
|
||||
replace into tbl1 values(100,105,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
connection conn2;
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
select * from tbl1 where pk in (100,200);
|
||||
delete from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
####����1 sfu����������+�ǿ��У�,�ӱ�������,����2������У�����1��replace ���У�sfu ͬһ��
|
||||
connection conn1;
|
||||
#select * from tbl1 t1 where t1.pk in(100,10,1,200) for update;
|
||||
select * from tbl1 where pk in(100,10,1,200) for update;
|
||||
|
||||
|
||||
connection conn2;
|
||||
insert into tbl1 values(100,102,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
--error 1205,4012
|
||||
update tbl1 set i1=i1-300 where pk in (100,1,123,8,9);
|
||||
update tbl1 set i1=i1-300 where pk in (100,123);
|
||||
--error 1205,4012
|
||||
update tbl1 set pk=1 where pk=1;
|
||||
#--error 1205,4012
|
||||
select * from tbl1 t1 where t1.pk in(100,200) for update;
|
||||
|
||||
connection conn1;
|
||||
--error 1205,4012
|
||||
replace into tbl1 values(100,105,'abdggc12','1agc1d',1.215,'2014-01-01 12:00:10',83.23,1);
|
||||
select * from tbl1 where pk in (100,200);
|
||||
update tbl1 set pk=1 where pk=1;
|
||||
commit;
|
||||
connection conn2;
|
||||
select * from tbl1 where pk in (100,200);
|
||||
commit;
|
||||
|
||||
select * from tbl1 where pk in (100,200);
|
||||
delete from tbl1 where pk in (100,200);
|
||||
331
tools/deploy/mysql_test/t/show_create_tablegroup.test
Normal file
331
tools/deploy/mysql_test/t/show_create_tablegroup.test
Normal file
@ -0,0 +1,331 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: yanmu.ztl
|
||||
#owner group: rs
|
||||
#description: test whether show create tablegroup stmt
|
||||
|
||||
#connect (conn_sys,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
#connection conn_sys;
|
||||
|
||||
# case 1: partition options
|
||||
# case 1.1: 非分区tablegroup
|
||||
let $index = 0;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# case 1.2: 一级分区tablegroup
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by hash partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by key 2 partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range (partition p0 values less than (100), partition p1 values less than (200), partition p2 values less than (MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range columns 2 (partition p0 values less than (1, '100'), partition p1 values less than (2, '200'), partition p2 values less than (MAXVALUE, MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list (partition p0 values in (0, 1), partition p1 values in (2, 3), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list columns 2 (partition p0 values in (('00', 0), ('01', 1)), partition p1 values in (('02', 2), ('03', 3)), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# case 1.2: 二级分区tablegroup
|
||||
|
||||
# 一级hash
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by hash subpartition by range subpartition template (subpartition p0 values less than (100), subpartition p1 values less than (200), subpartition p2 values less than (MAXVALUE)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by hash subpartition by range columns 2 subpartition template (subpartition p0 values less than (1, '100'), subpartition p1 values less than (2, '200'), subpartition p2 values less than (MAXVALUE, MAXVALUE)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by hash subpartition by list subpartition template (subpartition p0 values in (0, 1), subpartition p1 values in (2, 3), subpartition p3 values in (DEFAULT)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by hash subpartition by list columns 2 subpartition template (subpartition p0 values in (('00', 0), ('01', 1)), subpartition p1 values in (('02', 2), ('03', 3)), subpartition p3 values in (DEFAULT)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# 一级key
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by key 2 subpartition by range subpartition template (subpartition p0 values less than (100), subpartition p1 values less than (200), subpartition p2 values less than (MAXVALUE)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by key 2 subpartition by range columns 2 subpartition template (subpartition p0 values less than (1, '100'), subpartition p1 values less than (2, '200'), subpartition p2 values less than (MAXVALUE, MAXVALUE)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by key 2 subpartition by list subpartition template (subpartition p0 values in (0, 1), subpartition p1 values in (2, 3), subpartition p3 values in (DEFAULT)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by key 2 subpartition by list columns 2 subpartition template (subpartition p0 values in (('00', 0), ('01', 1)), subpartition p1 values in (('02', 2), ('03', 3)), subpartition p3 values in (DEFAULT)) partitions 2;
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# 一级range
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range subpartition by hash subpartitions 2 (partition p0 values less than (100), partition p1 values less than (200), partition p2 values less than (MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range subpartition by key 2 subpartitions 2 (partition p0 values less than (100), partition p1 values less than (200), partition p2 values less than (MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range subpartition by list subpartition template (subpartition p0 values in (0, 1), subpartition p1 values in (2, 3), subpartition p3 values in (DEFAULT)) (partition p0 values less than (100), partition p1 values less than (200), partition p2 values less than (MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range subpartition by list columns 2 subpartition template (subpartition p0 values in (('00', 0), ('01', 1)), subpartition p1 values in (('02', 2), ('03', 3)), subpartition p3 values in (DEFAULT)) (partition p0 values less than (100), partition p1 values less than (200), partition p2 values less than (MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# 一级range columns
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range columns 2 subpartition by hash subpartitions 2 (partition p0 values less than (1, '100'), partition p1 values less than (2, '200'), partition p2 values less than (MAXVALUE, MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range columns 2 subpartition by key 2 subpartitions 2 (partition p0 values less than (1, '100'), partition p1 values less than (2, '200'), partition p2 values less than (MAXVALUE, MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range columns 2 subpartition by list subpartition template (subpartition p0 values in (0, 1), subpartition p1 values in (2, 3), subpartition p3 values in (DEFAULT)) (partition p0 values less than (1, '100'), partition p1 values less than (2, '200'), partition p2 values less than (MAXVALUE, MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by range columns 2 subpartition by list columns 2 subpartition template (subpartition p0 values in (('00', 0), ('01', 1)), subpartition p1 values in (('02', 2), ('03', 3)), subpartition p3 values in (DEFAULT)) (partition p0 values less than (1, '100'), partition p1 values less than (2, '200'), partition p2 values less than (MAXVALUE, MAXVALUE));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# 一级list
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list subpartition by hash subpartitions 2 (partition p0 values in (0, 1), partition p1 values in (2, 3), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list subpartition by key 2 subpartitions 2 (partition p0 values in (0, 1), partition p1 values in (2, 3), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list subpartition by range subpartition template (subpartition p0 values less than (100), subpartition p1 values less than (200), subpartition p2 values less than (MAXVALUE)) (partition p0 values in (0, 1), partition p1 values in (2, 3), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list subpartition by range columns 2 subpartition template (subpartition p0 values less than (1, '100'), subpartition p1 values less than (2, '200'), subpartition p2 values less than (MAXVALUE, MAXVALUE)) (partition p0 values in (0, 1), partition p1 values in (2, 3), partition p3 values in (DEFAULT));
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
# 一级list columns
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list columns 2 subpartition by hash subpartitions 2 (partition p0 values in (('00', 0), ('01', 1)), partition p1 values in (('02', 2), ('03', 3)), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list columns 2 subpartition by key 2 subpartitions 2 (partition p0 values in (('00', 0), ('01', 1)), partition p1 values in (('02', 2), ('03', 3)), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list columns 2 subpartition by range subpartition template (subpartition p0 values less than (100), subpartition p1 values less than (200), subpartition p2 values less than (MAXVALUE)) (partition p0 values in (('00', 0), ('01', 1)), partition p1 values in (('02', 2), ('03', 3)), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
|
||||
inc $index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
eval create tablegroup show_create_tg_$index partition by list columns 2 subpartition by range columns 2 subpartition template (subpartition p0 values less than (1, '100'), subpartition p1 values less than (2, '200'), subpartition p2 values less than (MAXVALUE, MAXVALUE)) (partition p0 values in (('00', 0), ('01', 1)), partition p1 values in (('02', 2), ('03', 3)), partition p3 values in (DEFAULT));
|
||||
eval show create tablegroup show_create_tg_$index;
|
||||
--disable_warnings
|
||||
eval drop tablegroup if exists show_create_tg_$index;
|
||||
--enable_warnings
|
||||
18
tools/deploy/mysql_test/t/special_hook.test
Normal file
18
tools/deploy/mysql_test/t/special_hook.test
Normal file
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: linlin.xll
|
||||
#owner group: SQL1
|
||||
#description:
|
||||
#tags:sys_vars
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection conn1;
|
||||
--replace_column 1 ob_version_info
|
||||
select @@version_comment limit 1;
|
||||
SELECT @@session.auto_increment_increment;
|
||||
SHOW COLLATION;
|
||||
SHOW CHARACTER SET;
|
||||
SET NAMES latin1;
|
||||
disconnect conn1;
|
||||
31
tools/deploy/mysql_test/t/special_stmt.test
Normal file
31
tools/deploy/mysql_test/t/special_stmt.test
Normal file
@ -0,0 +1,31 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: linlin.xll
|
||||
#owner group: SQL1
|
||||
#description:
|
||||
#tags: sys_vars
|
||||
|
||||
show collation;
|
||||
show collation;
|
||||
--error 1064
|
||||
show collation test;
|
||||
SHOW CHARACTER SET;
|
||||
SHOW CHARACTER SET;
|
||||
--error 1064
|
||||
SHOW CHARACTER SET test;
|
||||
set names utf8;
|
||||
set names utf8;
|
||||
--error 1064
|
||||
set names;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
--error 1064
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED test;
|
||||
--error 1064
|
||||
show girls;
|
||||
--error 1064
|
||||
show girls;
|
||||
--error 1064
|
||||
show girls test;
|
||||
47
tools/deploy/mysql_test/t/sq_from.test
Normal file
47
tools/deploy/mysql_test/t/sq_from.test
Normal file
@ -0,0 +1,47 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: link.zt
|
||||
# owner group: sql4
|
||||
# description: from子查询测试集
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
#--real_sleep 1
|
||||
CREATE TABLE t1 (pk int primary key,c1 INT, c2 CHAR(100),c3 FLOAT);
|
||||
#--real_sleep 1
|
||||
SELECT * FROM t1 where pk = 1;
|
||||
INSERT INTO t1 VALUES (1, null,null,0.0);
|
||||
INSERT INTO t1 VALUES (2, 1,'',1.0);
|
||||
INSERT INTO t1 VALUES (3, 2,'abcde',2.0);
|
||||
INSERT INTO t1 VALUES (4, 100,'abcdefghij',3.0);
|
||||
CREATE TABLE t2 (pk int primary key,c1 INT, c2 VARCHAR(100));
|
||||
#--real_sleep 1
|
||||
INSERT INTO t2 VALUES (1, 1,'abcde');
|
||||
INSERT INTO t2 VALUES (2, 2,'abcde');
|
||||
SELECT sb1,sb2,sb3 FROM (SELECT c1 AS sb1, c2 AS sb2, c3*2 AS sb3
|
||||
FROM t1) AS sb WHERE sb1 > 1;
|
||||
SELECT AVG(sum_column1) FROM (SELECT SUM(c1) AS sum_column1 FROM t1
|
||||
GROUP BY c1) AS t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
#--real_sleep 1
|
||||
CREATE TABLE t1 (pk int primary key, c1 INT, c2 VARCHAR(100),c3 FLOAT);
|
||||
#--real_sleep 1
|
||||
INSERT INTO t1 VALUES (1, null,null,0.0);
|
||||
INSERT INTO t1 VALUES (2, 1,'',1.0);
|
||||
INSERT INTO t1 VALUES (3, 2,'abcde',2.0);
|
||||
INSERT INTO t1 VALUES (4, 100,'abcdefghij',3.0);
|
||||
CREATE TABLE t2 (pk int primary key, c1 INT, c2 VARCHAR(100));
|
||||
#--real_sleep 1
|
||||
INSERT INTO t2 VALUES (1, 1,'abcde');
|
||||
INSERT INTO t2 VALUES (2, 2,'abcde');
|
||||
SELECT sb1,sb2,sb3 FROM (SELECT c1 AS sb1, c2 AS sb2, c3*2 AS sb3
|
||||
FROM t1) AS sb WHERE sb1 > 1;
|
||||
SELECT AVG(sum_column1) FROM (SELECT SUM(c1) AS sum_column1 FROM t1
|
||||
GROUP BY c1) AS t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
37
tools/deploy/mysql_test/t/sq_from_2.test
Normal file
37
tools/deploy/mysql_test/t/sq_from_2.test
Normal file
@ -0,0 +1,37 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: link.zt
|
||||
# owner group: sql4
|
||||
# description: from子查询测试集2
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,a,b;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
CREATE TABLE t1 (pk int primary key, c1 INT, c2 VARCHAR(100),c3 FLOAT);
|
||||
INSERT INTO t1 VALUES (1, null,null,0.0);
|
||||
INSERT INTO t1 VALUES (2, 1,'',1.0);
|
||||
INSERT INTO t1 VALUES (3, 2,'abcde',2.0);
|
||||
INSERT INTO t1 VALUES (4, 100,'abcdefghij',3.0);
|
||||
CREATE TABLE t2 (pk int primary key, c1 INT, c2 VARCHAR(100));
|
||||
INSERT INTO t2 VALUES (1, 1,'abcde');
|
||||
INSERT INTO t2 VALUES (2, 2,'abcde');
|
||||
SELECT sb1,sb2,sb3 FROM (SELECT c1 AS sb1, c2 AS sb2, c3*2 AS sb3
|
||||
FROM t1) AS sb WHERE sb1 > 1;
|
||||
SELECT AVG(sum_column1) FROM (SELECT SUM(c1) AS sum_column1 FROM t1
|
||||
GROUP BY c1) AS t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
create table a(pk2 int primary key, a1 int, a2 int, a3 int) partition by key(pk2) partitions 4;
|
||||
create table b(pk1 int primary key, b1 int, b2 int, b3 int) partition by key(pk1) partitions 3;
|
||||
select a2 from (select *,case b1 when 1 then 2 else 3 end as c from a left join b on a2=b2) v where c>1;
|
||||
drop table a;
|
||||
drop table b;
|
||||
|
||||
create table t2(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 3;
|
||||
create table t3(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 2;
|
||||
select tb.c2, tb.c3 from (select t.* from (select * from t2 WHERE c2 = 1) t left JOIN t3 b on t.c3=b.c3)tb;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
79
tools/deploy/mysql_test/t/substring_index.test
Normal file
79
tools/deploy/mysql_test/t/substring_index.test
Normal file
@ -0,0 +1,79 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: yibo.tyf
|
||||
#owner group: sql1
|
||||
|
||||
#null
|
||||
SELECT SUBSTRING_INDEX(NULL, NULL, NULL);
|
||||
|
||||
|
||||
SELECT SUBSTRING_INDEX(NULL, NULL, 0);
|
||||
SELECT SUBSTRING_INDEX(NULL, NULL, 3);
|
||||
SELECT SUBSTRING_INDEX(NULL, NULL, -3);
|
||||
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', NULL, NULL);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', NULL, 0);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', NULL, 3);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', NULL, -3);
|
||||
|
||||
SELECT SUBSTRING_INDEX(NULL, 'abc', NULL);
|
||||
SELECT SUBSTRING_INDEX(NULL, 'abc', 0);
|
||||
SELECT SUBSTRING_INDEX(NULL, 'abc', 3);
|
||||
SELECT SUBSTRING_INDEX(NULL, 'abc', -3);
|
||||
|
||||
#empty
|
||||
SELECT SUBSTRING_INDEX('', '', 0);
|
||||
SELECT SUBSTRING_INDEX('', '', 3);
|
||||
SELECT SUBSTRING_INDEX('', '', -3);
|
||||
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', '', 0);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', '', 3);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', '', -3);
|
||||
|
||||
SELECT SUBSTRING_INDEX('', 'abc', 0);
|
||||
SELECT SUBSTRING_INDEX('', 'abc', 3);
|
||||
SELECT SUBSTRING_INDEX('', 'abc', -3);
|
||||
|
||||
#normal
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', 0);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', 3);
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', -3);
|
||||
|
||||
#convert
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', '0');
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', '3');
|
||||
SELECT SUBSTRING_INDEX('abcdabcdabc', 'abc', '-3');
|
||||
SELECT SUBSTRING_INDEX(1.414, 1, '-1');
|
||||
|
||||
#special
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775806);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775807);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775808);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775809);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775810);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', 9223372036854775811);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', -9223372036854775806);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', -9223372036854775807);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', -9223372036854775808);
|
||||
select SUBSTRING_INDEX( 'www.mysql.com','.', -9223372036854775809);
|
||||
|
||||
select substring_index('aaaaaaaaa1','aa',5);
|
||||
select substring_index('aaaaaaaaa1','aa',4);
|
||||
select substring_index('aaaaaaaaa1','aa',3);
|
||||
select substring_index('aaaaaaaaa1','aa',2);
|
||||
select substring_index('aaaaaaaaa1','aa',1);
|
||||
select substring_index('aaaaaaaaa1','aa',0);
|
||||
select substring_index('aaaaaaaaa1','aa',-1);
|
||||
select substring_index('aaaaaaaaa1','aa',-2);
|
||||
select substring_index('aaaaaaaaa1','aa',-3);
|
||||
select substring_index('aaaaaaaaa1','aa',-4);
|
||||
select substring_index('aaaaaaaaa1','aa',-5);
|
||||
|
||||
select substring_index('aaaaaaaaa1','aaaa',3);
|
||||
select substring_index('aaaaaaaaa1','aaaa',2);
|
||||
select substring_index('aaaaaaaaa1','aaaa',-1);
|
||||
select substring_index('aaaaaaaaa1','aaaa',0);
|
||||
select substring_index('aaaaaaaaa1','aaaa',-1);
|
||||
select substring_index('aaaaaaaaa1','aaaa',-2);
|
||||
select substring_index('aaaaaaaaa1','aaaa',-3);
|
||||
183
tools/deploy/mysql_test/t/topk.test
Normal file
183
tools/deploy/mysql_test/t/topk.test
Normal file
@ -0,0 +1,183 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
# tags: optimizer
|
||||
|
||||
# Test mutli avg
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
|
||||
insert into t1 values(1,1,1),(3,3,3),(5,5,5),(7,7,7),(9,9,9),(11,11,11),(13,13,13),(15,15,15),(17,17,17),(19,19,19);
|
||||
insert into t1 values(31,1,1),(33,3,3),(35,5,5),(37,7,7),(39,9,9),(41,11,11),(43,13,13),(45,15,15),(47,17,17),(49,19,19);
|
||||
insert into t1 values(2,2,2),(4,4,4),(6,6,6),(8,8,8),(10,10,10),(12,12,12),(14,14,14),(16,16,16),(18,18,18),(20,20,20);
|
||||
insert into t1 values(32,2,2),(34,4,4),(36,6,6),(38,8,8),(40,10,10),(42,12,12),(44,14,14),(46,16,16),(48,18,18),(50,20,20);
|
||||
|
||||
create table t2 (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
|
||||
create table t3 (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
|
||||
insert into t2 values(2,2,2),(4,4,4),(6,6,6),(8,8,8),(10,10,10),(12,12,12),(14,14,14),(16,16,16),(18,18,18),(20,20,20),(22,22,22);
|
||||
## ------------------case that not match the rules to use topk---------------------------##
|
||||
#without order by
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 limit 5;
|
||||
select @@is_result_accurate;
|
||||
#without limit
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1);
|
||||
select @@is_result_accurate;
|
||||
#without group by
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 order by avg(c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#is select for update
|
||||
## currently MySQL mode for update temporarily uses Oracle plan,
|
||||
## this syntax is prohibited under Oracle,
|
||||
## and it needs to be opened for mysql mode later
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5 for update nowait;
|
||||
select @@is_result_accurate;
|
||||
#without topk hint
|
||||
select avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#with found_rows
|
||||
select /*+topk(20 6)*/ sql_calc_found_rows avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#with subquery
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by (select c1 from t1 where c2 = 1 and c1 !=1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#with distinct
|
||||
select /*+topk(20 6)*/ distinct avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#with group_concat will not use topk
|
||||
select /*+topk(20 6)*/ sum(c1), avg(c2), group_concat(c3, c1) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
#not based table
|
||||
select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from (select * from t1 where c2 <10) as a group by a.c2 order by avg(a.c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
# join table
|
||||
select /*+topk(20 6)*/ distinct avg(t1.c1), avg(t1.c2), avg(t1.c3) from t1 , t2 group by t1.c2 order by avg(t1.c1) limit 5;
|
||||
select @@is_result_accurate;
|
||||
|
||||
##-----------------case that match rules of topk-----------------------##
|
||||
##hash agg + topk_sort
|
||||
select /*+topk(1 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 1;
|
||||
select @@is_result_accurate;
|
||||
|
||||
##hash agg + topk_sort
|
||||
select /*+topk(1 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by "aaa" limit 1;
|
||||
select @@is_result_accurate;
|
||||
|
||||
select /*+topk(90 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <30 group by c2 order by c3 limit 10;
|
||||
select @@is_result_accurate;
|
||||
|
||||
##merge agg + sort +topk
|
||||
select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 1;
|
||||
select @@is_result_accurate;
|
||||
## with offset
|
||||
select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by c3 limit 1 offset 4;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by c3 limit 1 offset 1000;
|
||||
select @@is_result_accurate;
|
||||
##merge agg + marterial +topk
|
||||
select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c2 limit 1;
|
||||
select @@is_result_accurate;
|
||||
##test limit 0
|
||||
select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 0;
|
||||
select @@is_result_accurate;
|
||||
##complex order by item
|
||||
select /*+topk(1 1)*/ c2, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3), sum(c1)/sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(1 1)*/ c1, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)/sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(1 1)*/ c2, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)/sum(c2) + avg(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(1 1)*/ avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
##different topk params
|
||||
select /*+topk(0 0)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(0 10)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(50 0)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(10000 1)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
select /*+topk(1 10000)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
select @@is_result_accurate;
|
||||
|
||||
|
||||
|
||||
##topk is in subquery
|
||||
select * from (select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5) as a;
|
||||
select c1 from t1 where c1 < any (select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5);
|
||||
(select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5) union (select /*+topk(0 10)*/ sum(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 7);
|
||||
|
||||
select c1 from t1 where (select /*+topk(0 10)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 1) > 1 ;
|
||||
|
||||
##TODO:this is not supported
|
||||
##select (select /*+topk(10 5)*/ avg(c1) from t1 where c2 =2 group by a.c2 order by sum(c2) limit 5) from t2 as a;
|
||||
#select (select /*+topk(10 5)*/ avg(c1) from t1 where c2 =2 group by c2 order by sum(a.c2 + c2) limit 5) from t2 as a ;
|
||||
|
||||
select * from (select /*+topk(10 5)*/ c3, c1, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 group by c2 order by c3 limit 7) as a left join t2 on a.c1 = t2.c1 left join t3 on t3.c1 = a.c1 order by a.c3;
|
||||
|
||||
##check whether plan cache will hit TODO:now plan cache did not support distribute plan
|
||||
|
||||
##check plan
|
||||
explain basic select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 limit 5;
|
||||
#without limit
|
||||
explain basic select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1);
|
||||
#without group by
|
||||
explain basic select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 order by avg(c1) limit 5;
|
||||
#is select for update
|
||||
explain basic select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5 for update nowait;
|
||||
#without topk hint
|
||||
explain basic select avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
#with found_rows
|
||||
explain basic select /*+topk(20 6)*/ sql_calc_found_rows avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
#with subquery
|
||||
explain basic select /*+topk(20 6)*/ avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by (select c1 from t1 where c2 = 1 and c1 != 1) limit 5;
|
||||
#with distinct
|
||||
explain basic select /*+topk(20 6)*/ distinct avg(c1), avg(c2), avg(c3) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
#with group_concat will not use topk
|
||||
explain basic select /*+topk(20 6)*/ sum(c1), avg(c2), group_concat(c3, c1) from t1 where c2 <10 group by c2 order by avg(c1) limit 5;
|
||||
|
||||
##check plan
|
||||
#todo 需要看一下这条sql的执行计划
|
||||
explain basic select /*+topk(1 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 1;
|
||||
#explain basic select /*+topk(1 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by "aaa" limit 1;
|
||||
explain basic select /*+topk(90 2) use_hash_aggregation*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <30 group by c2 order by c3 limit 10;
|
||||
##merge agg + sort +topk
|
||||
explain basic select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 1;
|
||||
##merge agg + marterial +topk
|
||||
explain basic select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by c3 limit 1 offset 4;
|
||||
##test limit 0
|
||||
explain basic select /*+topk(1 1)*/ c3, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by c3 limit 0;
|
||||
##complex order by item
|
||||
explain basic select /*+topk(1 1)*/ c2, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <12 group by c2 order by avg(c3), sum(c1)/sum(c2) limit 5;
|
||||
explain basic select /*+topk(1 1)*/ c1, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)/sum(c2) limit 5;
|
||||
explain basic select /*+topk(1 1)*/ c2, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)/sum(c2) + avg(c2) limit 5;
|
||||
explain basic select /*+topk(1 1)*/ avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
##different topk params
|
||||
explain basic select /*+topk(0 0)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
explain basic select /*+topk(0 10)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
explain basic select /*+topk(50 0)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
explain basic select /*+topk(10000 1)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
explain basic select /*+topk(1 10000)*/ c2, sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 where c2 <10 group by c2 order by avg(c3) desc, sum(c1)+sum(c2) limit 5;
|
||||
|
||||
##topk is in subquery
|
||||
set @@ob_enable_transformation=default;
|
||||
explain basic select * from (select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5) as a;
|
||||
explain basic select c1 from t1 where c1 < any (select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5);
|
||||
explain basic (select /*+topk(0 4)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 5) union (select /*+topk(0 10)*/ sum(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 7);
|
||||
|
||||
explain basic select c1 from t1 where (select /*+topk(0 10)*/ avg(c1) from t1 where c2 <10 group by c2 order by sum(c2) limit 1) > 1 ;
|
||||
|
||||
##TODO:this is not supported
|
||||
##select (select /*+topk(10 5)*/ avg(c1) from t1 where c2 =2 group by a.c2 order by sum(c2) limit 5) from t2 as a;
|
||||
#select (select /*+topk(10 5)*/ avg(c1) from t1 where c2 =2 group by c2 order by sum(a.c2 + c2) limit 5) from t2 as a ;
|
||||
|
||||
explain basic select * from (select /*+topk(10 5)*/ c3, c1, avg(c1), sum(c2), sum(c1) + sum(c2), count(c3), min(c3), max(c1), sum(c2)/count(c1), sum(c3)/sum(c1) from t1 group by c2 order by c3 limit 7) as a left join t2 on a.c1 = t2.c1 left join t3 on t3.c1 = a.c1;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
63
tools/deploy/mysql_test/t/trans_ac.test
Normal file
63
tools/deploy/mysql_test/t/trans_ac.test
Normal file
@ -0,0 +1,63 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
#owner: linlin.xll
|
||||
#owner group: SQL1
|
||||
#description: OUR GOAL: Make all this simple and effective!
|
||||
#tags: trx
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
|
||||
create table t2 (i int primary key, j int);
|
||||
insert into t2 values (1,1);
|
||||
set autocommit = 1;
|
||||
insert into t2 values (2,2);
|
||||
commit;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
set autocommit = 0;
|
||||
insert into t2 values (3,3);
|
||||
rollback;
|
||||
insert into t2 values (3,3);
|
||||
commit;
|
||||
--error 1062
|
||||
insert into t2 values (3,3);
|
||||
rollback;
|
||||
commit;
|
||||
|
||||
|
||||
set autocommit = 0;
|
||||
insert into t2 values (4,4);
|
||||
create table t3 (i int primary key, j int);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
# 测试ac从0变成1时的自动提交
|
||||
set autocommit = 0;
|
||||
insert into t2 values (5,5);
|
||||
set autocommit = 1;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
# 测试ac=0时调用begin的自动提交
|
||||
set autocommit = 0;
|
||||
insert into t2 values (6,6);
|
||||
begin;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
26
tools/deploy/mysql_test/t/truncate_table.test
Normal file
26
tools/deploy/mysql_test/t/truncate_table.test
Normal file
@ -0,0 +1,26 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner : dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# description:
|
||||
#
|
||||
use test;
|
||||
--disable_warnings
|
||||
drop table if exists tc1;
|
||||
--enable_warnings
|
||||
create table tc1(c1 int not null primary key, c2 varchar(11));
|
||||
insert into tc1 values (1, 'aaa');
|
||||
insert into tc1 values (2, 'bbbb');
|
||||
insert into tc1 values (3, 'ccccc');
|
||||
create index idxc2 on tc1(c2);
|
||||
alter table tc1 add index idxc3(c1,c2);
|
||||
select * from tc1;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
show index from tc1;
|
||||
truncate table tc1;
|
||||
let $is_truncate_table = 1;
|
||||
let $is_truncate_table = 0;
|
||||
select * from tc1;
|
||||
show index from tc1;
|
||||
drop table tc1;
|
||||
105
tools/deploy/mysql_test/t/trx_4.test
Normal file
105
tools/deploy/mysql_test/t/trx_4.test
Normal file
@ -0,0 +1,105 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn4,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
###
|
||||
# account test
|
||||
##
|
||||
create table t1(id int primary key, money1 int, when1 datetime default now());
|
||||
insert into t1(id,money1) values(1,100);
|
||||
insert into t1(id,money1) values(2,100);
|
||||
--replace_column 3 searched
|
||||
select id,money1,when1 from t1;
|
||||
|
||||
--let $user1_ct=query_get_value(select * from t1, when1, 1)
|
||||
--let $user2_ct=query_get_value(select * from t1, when1, 2)
|
||||
|
||||
--echo id1 - 100 id2 + 100
|
||||
connection conn1;
|
||||
begin;
|
||||
update t1 set money1 = money1-100 where id = 1;
|
||||
update t1 set money1 = money1+100 where id = 2;
|
||||
commit;
|
||||
--replace_column 3 searched
|
||||
select id,money1,when1 from t1;
|
||||
|
||||
connection conn2;
|
||||
--replace_column 3 searched
|
||||
select id,money1,when1 from t1;
|
||||
|
||||
--let $user1_c_2=query_get_value(select * from t1, when1, 1)
|
||||
--let $user2_c_2=query_get_value(select * from t1, when1, 2)
|
||||
|
||||
if($user1_c_2 != $user1_ct)
|
||||
{
|
||||
--echo send success
|
||||
}
|
||||
|
||||
if($user2_c_2 != $user2_ct)
|
||||
{
|
||||
--echo receive success
|
||||
}
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
###
|
||||
# account fail test
|
||||
##
|
||||
create table t1(id int primary key, money1 int, when1 datetime default now());
|
||||
insert into t1(id,money1) values(1,100);
|
||||
insert into t1(id,money1) values(2,100);
|
||||
--replace_column 3 searched
|
||||
select id,money1,when1 from t1;
|
||||
|
||||
--let $user1_ct=query_get_value(select * from t1, when1, 1)
|
||||
--let $user2_ct=query_get_value(select * from t1, when1, 2)
|
||||
|
||||
--echo id1 - 100 id2 + 100
|
||||
connection conn1;
|
||||
begin;
|
||||
update t1 set money1 = money1-100 where id = 1;
|
||||
disconnect conn1;
|
||||
|
||||
--error 2006
|
||||
update t1 set money1 = money1+100 where id = 2;
|
||||
--error 2006
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
--replace_column 3 searched
|
||||
select id,money1,when1 from t1;
|
||||
|
||||
--let $user1_c_2=query_get_value(select * from t1, when1, 1)
|
||||
--let $user2_c_2=query_get_value(select * from t1, when1, 2)
|
||||
|
||||
if($user1_c_2 != $user1_ct)
|
||||
{
|
||||
--echo send success
|
||||
}
|
||||
if($user1_c_2 == $user1_ct)
|
||||
{
|
||||
--echo send failed
|
||||
}
|
||||
|
||||
if($user2_c_2 != $user2_ct)
|
||||
{
|
||||
--echo receive success
|
||||
}
|
||||
if($user2_c_2 == $user2_ct)
|
||||
{
|
||||
--echo receive failed
|
||||
}
|
||||
|
||||
drop table t1;
|
||||
70
tools/deploy/mysql_test/t/trx_5.test
Normal file
70
tools/deploy/mysql_test/t/trx_5.test
Normal file
@ -0,0 +1,70 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn4,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
###
|
||||
# account test
|
||||
##
|
||||
create table t1(id int primary key, money1 int);
|
||||
insert into t1(id,money1) values(1,100);
|
||||
create table t2(id int primary key, money1 int);
|
||||
insert into t2(id,money1) values(1,100);
|
||||
|
||||
select id,money1 from t1;
|
||||
select id,money1 from t2;
|
||||
|
||||
--echo id1 - 100 id2 + 100
|
||||
connection conn1;
|
||||
begin;
|
||||
update t1 set money1 = money1-100 where id = 1;
|
||||
update t2 set money1 = money1+100 where id = 1;
|
||||
commit;
|
||||
|
||||
|
||||
connection conn2;
|
||||
select id,money1 from t1;
|
||||
select id,money1 from t2;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
|
||||
###
|
||||
# account test
|
||||
##
|
||||
create table t1(id int primary key, money1 int);
|
||||
insert into t1(id,money1) values(1,100);
|
||||
create table t2(id int primary key, money1 int);
|
||||
insert into t2(id,money1) values(1,100);
|
||||
|
||||
select id,money1 from t1;
|
||||
select id,money1 from t2;
|
||||
|
||||
--echo id1 - 100 id2 + 100
|
||||
connection conn1;
|
||||
begin;
|
||||
update t1 set money1 = money1-100 where id = 1;
|
||||
disconnect conn1;
|
||||
--error 2006
|
||||
update t2 set money1 = money1+100 where id = 1;
|
||||
--error 2006
|
||||
commit;
|
||||
sleep 1;
|
||||
|
||||
connection conn2;
|
||||
select id,money1 from t1;
|
||||
select id,money1 from t2;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
81
tools/deploy/mysql_test/t/trx_6.test
Normal file
81
tools/deploy/mysql_test/t/trx_6.test
Normal file
@ -0,0 +1,81 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn4,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
###
|
||||
# bad case
|
||||
##
|
||||
create table t1(id int primary key, money1 int);
|
||||
|
||||
insert into t1 values(1,100);
|
||||
|
||||
## setup session timeout parameters
|
||||
--disable_query_log
|
||||
connection conn1;
|
||||
set session ob_query_timeout = 2000000; #-- 2s
|
||||
set session ob_trx_timeout = 20000000; #-- 20s
|
||||
set session ob_trx_idle_timeout = 10000000; #-- 10s
|
||||
connection conn2;
|
||||
set session ob_query_timeout = 2000000; #-- 2s
|
||||
set session ob_trx_timeout = 20000000; #-- 20s
|
||||
set session ob_trx_idle_timeout = 10000000; #-- 10s
|
||||
connection conn3;
|
||||
set session ob_query_timeout = 2000000; #-- 2s
|
||||
set session ob_trx_timeout = 20000000; #-- 20s
|
||||
set session ob_trx_idle_timeout = 10000000; #-- 10s
|
||||
connection conn4;
|
||||
set session ob_query_timeout = 2000000; #-- 2s
|
||||
set session ob_trx_timeout = 20000000; #-- 20s
|
||||
set session ob_trx_idle_timeout = 10000000; #-- 10s
|
||||
--enable_query_log
|
||||
|
||||
connection conn1;
|
||||
begin;
|
||||
update t1 set money1 = money1+100 where id=2;
|
||||
|
||||
connection conn2;
|
||||
begin;
|
||||
insert into t1 values(2,100);
|
||||
|
||||
connection conn1;
|
||||
commit;
|
||||
connection conn2;
|
||||
ROLLBACK;
|
||||
|
||||
select * from t1;
|
||||
|
||||
|
||||
connection conn1;
|
||||
begin;
|
||||
insert into t1 values(3,100);
|
||||
commit;
|
||||
|
||||
connection conn2;
|
||||
begin;
|
||||
update t1 set money1 = money1+100 where id=3;
|
||||
|
||||
connection conn3;
|
||||
set @@ob_trx_timeout=100000000;
|
||||
begin;
|
||||
set @@ob_query_timeout = 10000000;
|
||||
--error 1205, 4012
|
||||
delete from t1 where id = 3;
|
||||
|
||||
connection conn2;
|
||||
commit;
|
||||
connection conn3;
|
||||
ROLLBACK;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
112
tools/deploy/mysql_test/t/trx_timeout.test
Normal file
112
tools/deploy/mysql_test/t/trx_timeout.test
Normal file
@ -0,0 +1,112 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
--echo set timeout to 10s
|
||||
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
set global ob_trx_timeout = 10000000;
|
||||
create table t1(c1 int primary key, c2 int);
|
||||
insert into t1 values(1,1);
|
||||
insert into t1 values(2,2);
|
||||
insert into t1 values(3,3);
|
||||
disconnect conn3;
|
||||
|
||||
--echo create 2 sessions
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
|
||||
connection conn1;
|
||||
--echo trx timeout
|
||||
begin;
|
||||
insert into t1 values(4,4);
|
||||
--real_sleep 3
|
||||
insert into t1 values(5,5);
|
||||
--real_sleep 3
|
||||
insert into t1 values(6,6);
|
||||
--real_sleep 3
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
|
||||
begin;
|
||||
insert into t1 values(7,7);
|
||||
--real_sleep 3
|
||||
insert into t1 values(8,8);
|
||||
--real_sleep 3
|
||||
insert into t1 values(9,9);
|
||||
--real_sleep 3
|
||||
insert into t1 values(10,10);
|
||||
--real_sleep 3
|
||||
--error 6002
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
|
||||
--echo trx idle timeout
|
||||
|
||||
begin;
|
||||
insert into t1 values(11,11);
|
||||
--real_sleep 12
|
||||
--error 4012
|
||||
insert into t1 values(12,12);
|
||||
--error 6002
|
||||
commit;
|
||||
|
||||
select * from t1;
|
||||
|
||||
--echo test two users
|
||||
|
||||
#下面的case,在切主场景下,上面的事务被kill,行锁会释放,下面的事务不会有锁冲突,从而造成case失败
|
||||
#connection conn1;
|
||||
#begin;
|
||||
#select * from t1 where c1=1 for update;
|
||||
#sleep 11;
|
||||
#connection conn2;
|
||||
#begin;
|
||||
#--error 1205,4012
|
||||
#select * from t1 where c1=1 for update;
|
||||
#--error 4012
|
||||
#update t1 set c2=1 where c1=1;
|
||||
#--error 4012
|
||||
#commit;
|
||||
#select * from t1;
|
||||
#connection conn1;
|
||||
#--error 4012
|
||||
#commit;
|
||||
|
||||
#begin;
|
||||
#update t1 set c2=1 where c1=2;
|
||||
#--real_sleep 3
|
||||
#update t1 set c2=1 where c1=3;
|
||||
#--real_sleep 3
|
||||
#update t1 set c2=1 where c1=4;
|
||||
#--real_sleep 3
|
||||
#update t1 set c2=1 where c1=5;
|
||||
#--real_sleep 3
|
||||
|
||||
#connection conn2;
|
||||
#begin;
|
||||
#--error 1205,4012
|
||||
#update t1 set c2=c2+1 where c1=2;
|
||||
#--error 4012
|
||||
#update t1 set c2=c2+1 where c1=3;
|
||||
#--error 4012
|
||||
#update t1 set c2=c2+1 where c1=4;
|
||||
#--error 4012
|
||||
#update t1 set c2=c2+1 where c1=5;
|
||||
#--error 4012
|
||||
#commit;
|
||||
#select * from t1;
|
||||
#connection conn1;
|
||||
#--error 4012
|
||||
#commit;
|
||||
set global ob_trx_timeout = 100000000;
|
||||
22
tools/deploy/mysql_test/t/trx_timeout_bug.test
Normal file
22
tools/deploy/mysql_test/t/trx_timeout_bug.test
Normal file
@ -0,0 +1,22 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
#####bug:事务中范围更新超时时间未生效
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(pk int primary key, i1 int, v1 varchar(20));
|
||||
set autocommit=0;
|
||||
set session ob_trx_timeout=10000000;
|
||||
#because start from 4.0 empty delete won't cause session into txn,
|
||||
#we do some really modifies here
|
||||
--disable_query_log
|
||||
insert into t1 values(1,1,'1');
|
||||
--enable_query_log
|
||||
delete from t1 where pk<4;
|
||||
sleep 12;
|
||||
--error 6002
|
||||
commit;
|
||||
126
tools/deploy/mysql_test/t/two_order_by.test
Normal file
126
tools/deploy/mysql_test/t/two_order_by.test
Normal file
@ -0,0 +1,126 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: bin.lb
|
||||
#owner group: sql1
|
||||
#tags: optimizer
|
||||
#description:
|
||||
|
||||
##
|
||||
# test index union
|
||||
##
|
||||
--disable_query_log
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
--real_sleep 1
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (pk1 int,pk2 varchar(124),pk3 timestamp(6) default "2012-01-01 12:00:00", c1 int,c2 varchar(1024),c3 timestamp(6) default "2012-01-01 12:00:00",c4 int,c5 int,c6 int,primary key(pk1,pk2,pk3));
|
||||
--disable_query_log
|
||||
create index i1 on t1(c1);
|
||||
create index i2 on t1(c1,c2);
|
||||
create index i3 on t1(c1,c2,c3);
|
||||
create index i4 on t1(c4,c5,c6);
|
||||
|
||||
create table t2 (pk1 int primary key, c1 int not null,c2 varchar(1024) not null,c3 timestamp(6) default "2012-01-01 12:00:00",c4 int,c5 int,c6 int);
|
||||
--disable_query_log
|
||||
create index i11 on t2(c1) storing(c2);
|
||||
create index i12 on t2(c4,c5) storing(c3);
|
||||
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
|
||||
--disable_query_log
|
||||
insert into t1 values
|
||||
(1, 'primarykey1', '2013-12-11 01:01:01',44,'column11','2013-12-11 11:11:11',4,2,3),
|
||||
(2, 'primarykey2', '2013-12-11 01:01:02',33,'column21','2013-12-11 11:11:12',3,1,3),
|
||||
(3, 'primarykey3', '2013-12-11 01:01:03',22,'column32','2013-12-11 11:11:13',2,1,2),
|
||||
(4, 'primarykey4', '2013-12-11 01:01:04',11,'column42','2013-12-11 11:11:14',1,3,2);
|
||||
|
||||
insert into t2 values
|
||||
(1,44,'column11','2013-12-11 11:11:11',4,2,3),
|
||||
(2,10,'column21','2013-12-11 11:11:12',3,1,2),
|
||||
(3,22,'column32','2013-12-11 11:11:13',2,0,1),
|
||||
(4,11,'column43','2013-12-11 11:11:14',1,-1,0),
|
||||
(5,33,'column54','2013-12-11 11:11:15',0,-2,-1),
|
||||
(6,33,'column65','2013-12-11 11:11:16',3,0,3);
|
||||
|
||||
--enable_query_log
|
||||
|
||||
##############one table union #############
|
||||
#all use index
|
||||
--sorted_result
|
||||
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union all (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
|
||||
select * from ((select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union all (select /*+index(t1 i1) */ pk1,c1 from t2 where c1 > 10 order by c1) ) a order by pk1, a.c1;
|
||||
--sorted_result
|
||||
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
|
||||
--sorted_result
|
||||
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) except (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
|
||||
--sorted_result
|
||||
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) intersect (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
|
||||
|
||||
--sorted_result
|
||||
(select c1,c2,c3 from t1 where c1=11 order by c2) union (select c1,c2,c3 from t1 where c1=22 and c2 like 'column3_' order by c1) union distinct select c1,c2,c3 from t1 where c1>22 and c2 is not null and c3>='2013-12-11 11:11:11' union all (select c1,c2,c3 from t1 where c4<2 and c5>1 and c6=3 order by c4) except (select c1,c2,c3 from t1 where c3 <= '2013-12-11 11:11:11' order by c3);
|
||||
|
||||
--sorted_result
|
||||
select * from ((select * from t1 where c1=44) union (select * from t1 where c1=33 and c2 like 'column%') union all (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
|
||||
--sorted_result
|
||||
select * from ((select * from t1 where c1=44) union all (select * from t1 where c1=33 and c2 like 'column%') except (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
|
||||
--sorted_result
|
||||
select * from ((select * from t1 where c1=44) intersect (select * from t1 where c1=33 and c2 like 'column%') union all (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
|
||||
|
||||
--sorted_result
|
||||
(select c1,c4 from t1 where c1 in (33,11) order by c1) union all select c1,c4 from t1 where c1=44;
|
||||
--sorted_result
|
||||
(select c1,c4 from t1 where c1 in (1,44) order by c1) union all (select c1,c4 from t1 where c1 in (33,11) order by c1);
|
||||
--sorted_result
|
||||
(select c1,c4 from t1 where c1 in (1,44) order by c1) union all (select c1,c4 from t1 where c1 =33 order by c4);
|
||||
# TODO(@linsheng): BUG
|
||||
# (select c1,c4 from t1 where c1 in (1,44) order by c1) union (select c1,c4 from t1 where c1 =33 order by c4);
|
||||
# (select c1,c4 from t1 where c1 in (1,44) order by c4) union (select c1,c4 from t1 where c1 =33 order by c4);
|
||||
# (select c1,c4 from t1 where c1 in (1,44) order by c1) except (select c1,c4 from t1 where c1 =33 order by c4);
|
||||
# (select c1,c4 from t1 where c1 in (1,44) order by c4) intersect (select c1,c4 from t1 where c1 =33 order by c4);
|
||||
--sorted_result
|
||||
select c1,c4 from t1 where c1=44 union (select c1,c4 from t1 where c1 not in (33,11) order by c1);
|
||||
--sorted_result
|
||||
(select c1,c4 from t1 where c1 not in (33,11) order by c1) except select c1,c4 from t1 where c1=44;
|
||||
--sorted_result
|
||||
(select c1,c4 from t1 where c1 not in (33,11) order by c1) intersect select c1,c4 from t1 where c1=44;
|
||||
|
||||
|
||||
(select c4,c5,c6 from t1 order by c1 limit 2) union all (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
|
||||
(select c4,c5,c6 from t1 order by c4 limit 2) union (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
|
||||
(select c4,c5,c6 from t1 order by c2 limit 2) except (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
|
||||
(select c4,c5,c6 from t1 order by c4 limit 2) intersect (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
|
||||
|
||||
################ multi table union #############
|
||||
#all use index
|
||||
--sorted_result
|
||||
select /*+index(t1 i1)*/ pk1,c1 from t1 union select /*+index(t2 i11)*/ pk1,c1 from t2;
|
||||
--sorted_result
|
||||
select /*+index(t1 i1)*/ pk1,c1 from t1 union all select /*+index(t2 i11)*/ pk1,c1 from t2;
|
||||
--sorted_result
|
||||
select /*+index(t1 i1)*/ pk1,c1 from t1 except select /*+index(t2 i11)*/ pk1,c1 from t2;
|
||||
--sorted_result
|
||||
select /*+index(t1 i1)*/ pk1,c1 from t1 intersect select /*+index(t2 i11)*/ pk1,c1 from t2;
|
||||
|
||||
--sorted_result
|
||||
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1) union (select c1,c4 from t2 where c1=44 order by c1);
|
||||
--sorted_result
|
||||
(select c1,c4 from t2 where c1=44 order by c1) union (select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1);
|
||||
--sorted_result
|
||||
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t2.c1) union all (select c1,c4 from t2 where c1=44 order by c1);
|
||||
--sorted_result
|
||||
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1) except (select c1,c4 from t2 where c1=44 order by c2);
|
||||
--sorted_result
|
||||
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t2.c1) intersect (select c1,c4 from t2 where c1=44 order by c1);
|
||||
|
||||
###use two order by in from sql
|
||||
select * from (select * from t1 where pk1 in(1,2,3,4,5,6)) a order by pk2;
|
||||
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a order by pk2;
|
||||
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a order by pk1;
|
||||
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a where a.c2>='abc' order by pk1;
|
||||
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a where a.c2>='abc' order by pk2;
|
||||
--enable_abort_on_error
|
||||
56
tools/deploy/mysql_test/t/update_behavior.test
Normal file
56
tools/deploy/mysql_test/t/update_behavior.test
Normal file
@ -0,0 +1,56 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: kaizhan.dkz
|
||||
#owner group: sql1
|
||||
#tags: update
|
||||
#description:
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
sleep 2;
|
||||
drop database if exists db1;
|
||||
create database if not exists db1;
|
||||
use db1;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(c1 int primary key, c2 int, c3 int);
|
||||
insert into test values(1,1,1);
|
||||
insert into test values(2,2,2);
|
||||
|
||||
set @@global.ob_enable_plan_cache= 0;
|
||||
connect (conn,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
use db1;
|
||||
update test set c2=c1+c2, c3=c2+c1;
|
||||
let $value = query_get_value(select c2 from test where c1 = 1, c2, 1);
|
||||
if ($value == 2)
|
||||
{
|
||||
--echo succeed
|
||||
}
|
||||
let $value = query_get_value(select c3 from test where c1 = 1, c3, 1);
|
||||
if ($value == 3)
|
||||
{
|
||||
--echo succeed
|
||||
}
|
||||
select * from test;
|
||||
#set @@global.sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION, STANDARD_ASSIGNMENT";
|
||||
#
|
||||
#connect (conn2,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
#use db1;
|
||||
#update test set c2=c1+c2, c3=c2+c1;
|
||||
#let $value = query_get_value(select c2 from test where c1 = 1, c2, 1);
|
||||
#if ($value == 3)
|
||||
#{
|
||||
# --echo succeed
|
||||
#}
|
||||
#let $value = query_get_value(select c3 from test where c1 = 1, c3, 1);
|
||||
#if ($value == 3)
|
||||
#{
|
||||
# --echo succeed
|
||||
#}
|
||||
#select * from test;
|
||||
#set @@global.sql_mode = "STRICT_TRANS_TABLES";
|
||||
set @@global.ob_enable_plan_cache= 1;
|
||||
drop table test;
|
||||
drop database db1;
|
||||
22
tools/deploy/mysql_test/t/update_column_use_other.test
Normal file
22
tools/deploy/mysql_test/t/update_column_use_other.test
Normal file
@ -0,0 +1,22 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: kaizhan.dkz
|
||||
#owner group: sql1
|
||||
#tags: update
|
||||
#description:
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(pk int primary key, c1 int);
|
||||
insert into t1 values(1,2), (2, 3),(3,4),(4,5);
|
||||
select * from t1;
|
||||
update t1 set c1=pk ;
|
||||
select * from t1;
|
||||
update t1 set c1=pk where pk=1 ;
|
||||
select * from t1;
|
||||
update t1 set c1=pk where pk in (1,2,3,4) ;
|
||||
select * from t1;
|
||||
update t1 set c1=pk-0 ;
|
||||
select * from t1;
|
||||
237
tools/deploy/mysql_test/t/update_delete_limit_unique_key.test
Normal file
237
tools/deploy/mysql_test/t/update_delete_limit_unique_key.test
Normal file
@ -0,0 +1,237 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: link.zt
|
||||
#owner group: sql1
|
||||
|
||||
--source mysql_test/include/index_quick_major.inc
|
||||
#case:int as idx
|
||||
--disable_warnings
|
||||
drop table if exists tbl1;
|
||||
--enable_warnings
|
||||
create table tbl1 (pk int,i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3),i6 bool, primary key(pk));
|
||||
insert into tbl1 values(1,1,'abc12','1agc',1.25,'2014-01-01 12:00:00',23.23,1),
|
||||
(2,10,'23abc12','4agc1',-0.25,'2015-11-01 12:00:00',-23.230,0),
|
||||
(3,201,'xx23abc12','cagc1',-2.25,'2015-11-21 11:20:10',3.231,1),
|
||||
(4,80,'zx23abc12','zcagc1',2.25,'2013-01-21 11:20:10',-3.231,1),
|
||||
(5,53,'cx23abc12','rcagc1',109.25,'2016-01-22 11:20:10',-13.131,0),
|
||||
(6,78,'tx23abc12','icagc1',-109.25,'2014-09-16 16:24:00',-13.531,1),
|
||||
(7,400,'yx23abc12','ocagc1',85.85,'2014-09-17 16:20:21',-93.131,0),
|
||||
(8,50,'vx23abc12','wcagc1',-85.85,'2014-09-10 16:20:21',93.131,1),
|
||||
(9,610,'ukx23abc12','pecagc1',-1.85,'2014-09-19 16:20:21',99.131,0),
|
||||
(10,42,'kx23abc12','ecagc1',-85.86,'2014-09-18 16:20:21',-99.131,1),
|
||||
(11,null,null,null,null,null,null,null);
|
||||
create unique index idx_1 on tbl1(i1);
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
select date_sub(null, INTERVAL -6 DAY);
|
||||
select * from tbl1;
|
||||
update tbl1 set i1=i1-20 where pk<=11 limit 20;
|
||||
update tbl1 set i1=i1+20 where pk<=11 limit 20;
|
||||
select * from tbl1;
|
||||
update tbl1 set v2=concat(v2,'abc') where i1<=100 order by i1 limit 10;
|
||||
update tbl1 set v2=substr(v2,1,10) where i1<=100 order by i1 limit 10;
|
||||
select * from tbl1;
|
||||
#update tbl1 set i3=concat(v2,'abc') where i1 in (1,201,10,80,420,600) order by i1 asc limit 5;
|
||||
#update tbl1 set i3=substr(v2,1,10) where i1 in (1,201,10,80,420,600) order by i1 asc limit 5;
|
||||
update tbl1 set i3=concat(v2,'abc') where i1 in (1,201,10,80,420,600) limit 5;
|
||||
update tbl1 set i3=substr(v2,1,10) where i1 in (1,201,10,80,420,600) limit 5;
|
||||
--disable_parsing
|
||||
update tbl1 set i4=i4*2;
|
||||
update tbl1 set i4=i4/2;
|
||||
#update tbl1 set d4=date_sub(d4, INTERVAL -6 DAY) ;
|
||||
update tbl1 set d4=date_sub(d4, INTERVAL -6 DAY) where d4 is not null;
|
||||
#update tbl1 set d4=date_add(d4, INTERVAL -6 DAY) ;
|
||||
update tbl1 set d4=date_add(d4, INTERVAL -6 DAY) where d4 is not null;
|
||||
update tbl1 set i5=i5+0.05;
|
||||
update tbl1 set i5=i5-0.05;
|
||||
update tbl1 set i6=i6 and 1;
|
||||
select * from tbl1;
|
||||
select * from tbl1 where i1>10 and i1<=1000;
|
||||
select * from tbl1 where i1>10+1 and i1<1000;
|
||||
select * from tbl1 where i1 between 10+1 and 1000;
|
||||
prepare stmt1 from select * from tbl1 where i1>?+1 and i1<?-10;
|
||||
set @a=10;
|
||||
set @b=1000;
|
||||
execute stmt1 using @a, @b;
|
||||
set @a=10+1-1;
|
||||
set @b=1000-1+1;
|
||||
execute stmt1 using @a, @b;
|
||||
select * from tbl1 where i1>10 and i1<1000-10;
|
||||
select * from tbl1 where i1>10+1 and i1<1000-10;
|
||||
select * from tbl1 where i1>1*10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<=1000*2;
|
||||
select * from tbl1 where i1>10*2+3 and i1<=1000*2;
|
||||
select * from tbl1 where i1>1*50/5+1 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50*1+3 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=(1000 mod 1001) +10;
|
||||
prepare stmt1 from select * from tbl1 where i1>(? mod 10) and i1<(? mod 1005)-10;
|
||||
set @a=10;
|
||||
set @b=1001;
|
||||
execute stmt1 using @a, @b;
|
||||
set @a=10+1-1;
|
||||
set @b=1001-1+1;
|
||||
execute stmt1 using @a, @b;
|
||||
select * from tbl1 where i1>10 and i1<1000-10;
|
||||
select * from tbl1 where i1>10+1 and i1<1000-10;
|
||||
select * from tbl1 where i1>1*10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<=1000*2;
|
||||
select * from tbl1 where i1>10*2+3 and i1<=1000*2;
|
||||
update tbl1 set i1=i1+1-1 where i1>10*2+3 and i1<=1000*2;
|
||||
select * from tbl1 where i1>1*50/5+1 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50*1+3 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=(1000 mod 1001) +10;
|
||||
select * from tbl1 where i1>10 and i1<=(1000 mod 1001) +10;
|
||||
select * from tbl1 where i1>10+0 and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+null and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) +null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) or i1 is null;
|
||||
update tbl1 set i1=i1+1-1 where i1>=10+1 and i1<=(1000*2) or i1 is null;
|
||||
--error 1064
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) or i1 is (null+1);
|
||||
--error 5083
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) or i1 is null+1;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is not null;
|
||||
update tbl1 set i1=i1+100-100 where i1>=10+1 and i1<=(1000*2) and i1 is not null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i1 = 610;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i3 = 'cx23abc12';
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) and i5 between 0 and 1000;
|
||||
prepare stmt1 from select * from tbl1 where i1>=?+1 and i1<=(?*2) and i5 between ? and ?;
|
||||
set @a=10;
|
||||
set @b=100;
|
||||
set @c=0;
|
||||
set @d=1000;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
set @a=10+1-1;
|
||||
set @b=1000-1+1;
|
||||
set @c=0+1000-1+1-1000;
|
||||
set @d=1000-1+1;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
prepare stmt1 from update tbl1 set i1=i1+15-15 where i1>=?+1 and i1<=(?*2) and i5 between ? and ?;
|
||||
set @a=10;
|
||||
set @b=100;
|
||||
set @c=0;
|
||||
set @d=1000;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
set @a=10+1-1;
|
||||
set @b=1000-1+1;
|
||||
set @c=0+1000-1+1-1000;
|
||||
set @d=1000-1+1;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*10) and i5 between -100 and 1000;
|
||||
select * from tbl1 where i1 between 10+1 and (100*10) and i5 between -100 and 1000;
|
||||
select * from tbl1 where i1<=round(1000.5) and i1>=round(0.5);
|
||||
update tbl1 set i1=i1*2/2 where i1<=round(1000.5) and i1>=round(0.5);
|
||||
select * from tbl1 where i1>=0 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
update tbl1 set i1=i1+1-1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
update tbl1 set i5=i5+1-1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
#case:more than noe cloumn idx
|
||||
drop index idx_1 on tbl1;
|
||||
create index idx_12 on tbl1(i1,i5);
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
select * from tbl1 where i1>10 and i1<=1000;
|
||||
select * from tbl1 where i1>10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<1000-10;
|
||||
select * from tbl1 where i1>10+1 and i1<1000-10;
|
||||
select * from tbl1 where i1>1*10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<=1000*2;
|
||||
select * from tbl1 where i1>10*2+3 and i1<=1000*2;
|
||||
select * from tbl1 where i1>10 and i1<=(1000 mod 1001) +10;
|
||||
select * from tbl1 where i1>10+0 and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+null and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) +null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) or i1 is null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is not null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i1 = 610;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i3 = 'cx23abc12';
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) and i5 between 0 and 1000;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*10) and i5 between -100 and 1000;
|
||||
select * from tbl1 where i1<=round(1000.5) and i1>=round(0.5);
|
||||
select * from tbl1 where i1>=0 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1 where i1 in(1,10,42,50,null,610,400);
|
||||
select * from tbl1 where (i1,i4) in((1,1.25),(10,-0.25),(80,2.25),(42,-85.85));
|
||||
select * from tbl1 where (i4,i1) in ((1.25,1),(-0.25,10),(-85.85,42),(2.25,80));
|
||||
#case:more than noe cloumn idx
|
||||
#drop index idx_1 on tbl1;
|
||||
create index idx_15 on tbl1(i1,i5);
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
select * from tbl1 where i1>10 and i1<=1000;
|
||||
select * from tbl1 where i1>10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<1000-10;
|
||||
select * from tbl1 where i1>10+1 and i1<1000-10;
|
||||
select * from tbl1 where i1>1*10+1 and i1<1000;
|
||||
select * from tbl1 where i1>10 and i1<=1000*2;
|
||||
select * from tbl1 where i1>10*2+3 and i1<=1000*2;
|
||||
select * from tbl1 where i1>1*50/5+1 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50 and i1<=1000*2/2+1;
|
||||
select * from tbl1 where i1>50*1+3 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=1000;
|
||||
select * from tbl1 where i1>(19 mod 10)+1 and i1<=(1000 mod 1001) +10;
|
||||
select * from tbl1 where i1>10 and i1<=(1000 mod 1001) +10;
|
||||
select * from tbl1 where i1>10+0 and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+null and i1<=(1000*1001) +10;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) +null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) or i1 is null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(1000*2) and i1 is not null;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i1 = 610;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) or i3 = 'cx23abc12';
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*2) and i5 between 0 and 1000;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*10) and i5 between -100 and 1000;
|
||||
select * from tbl1 where i1>10+1 and i1<1000 and pk<=10;
|
||||
select * from tbl1 where i1>-9999999999+1+0 and i1<10000000000-2+1-1+2-2+3-3+4-4+5-5+6-6+7-7+8-8+9-9+0-0+10-10 and pk<=10;
|
||||
select * from tbl1 where i1>-9999999999+1+0 and i1<10000000000-2+1-1+2-2+3-3+4-4+5-5+6-6+7-7+8-8+9-9+0-0+10-10 ;
|
||||
select * from tbl1 where i1>=10+1 and i1<=(100*10) and i5 between -100 and 1000;
|
||||
prepare stmt1 from select * from tbl1 where i1>=?+1 and i1<=(?*10) and i5 between ? and ?;
|
||||
set @a=10;
|
||||
set @b=100;
|
||||
set @c=-100;
|
||||
set @d=1000;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
set @a=10+1-1+10-10+1-1+1-1+1-1+1-1;
|
||||
set @b=100-1+1+10-10+10-10+1-1+10-10;
|
||||
set @c=-100+1-1+1-1+1-1+1-1+2-2+3-3+4-4+5-5+6-6+7-7+8-8+9-9+10-10;
|
||||
set @d=1000+1-1+1-1+1-1+1-1+2-2+3-3+4-4+5-5+6-6+7-7+8-8+9-9+10-10;
|
||||
execute stmt1 using @a, @b,@c,@d;
|
||||
select * from tbl1 where i1>=length('abc')-10 and i1<length('dagafdgafdgfg')+1000;
|
||||
set @a='agafgfdgfdghfdhadfh';
|
||||
set @b='adgfdagdfgggfgfdgfgfgfgfdgdfgadfghdfgfdg';
|
||||
prepare stmt1 from select * from tbl1 where i1>=length(?)-10 and i1<length(?)+1000;
|
||||
execute stmt1 using @a, @b;
|
||||
select * from tbl1 where (i1,i5) in ((1,23.23),(42,-99.131),(50,93.131),(610,99.131));
|
||||
select * from tbl1 where (i5,i1) in ((23.23,1),(-99.131,42),(93.131,50),(99.131,610));
|
||||
select * from tbl1 where (i1,i5,i4) in ((1,23.23,1.25),(610,99.131,-1.85),(42,-99.131,-85.85));
|
||||
select * from tbl1 where (i4,i1,i5) in ((1.25,1,23.23),(-1.85,610,99.131),(-85.85,42,-99.131));
|
||||
prepare stmt1 from select * from tbl1 where (i4,i1,i5) in ((1.25,?,23.23),(-1.85,?,99.131),(?,42,?));
|
||||
set @a=-99.131;
|
||||
set @b=610;
|
||||
set @c=1;
|
||||
set @d=-85.85;
|
||||
execute stmt1 using @c,@b,@d,@a;
|
||||
prepare stmt1 from select * from tbl1 where i1>=?*?+?+? and i1<=?*?+?-?;
|
||||
set @a=-10;
|
||||
set @b=2;
|
||||
set @c=1;
|
||||
set @d=-1;
|
||||
set @e=100;
|
||||
set @f=10;
|
||||
set @g=2;
|
||||
set @h=3;
|
||||
execute stmt1 using @a,@b,@c,@d,@e,@f,@g,@h;
|
||||
#test update
|
||||
update tbl1 set i1=i1+1-1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
update tbl1 set i5=i5+1-1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
update tbl1 set i5=round(i5) where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
update tbl1 set d4=date_add(d4, INTERVAL -6 hour) where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1;
|
||||
delete from tbl1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1 where i1>=EXTRACT(DAY FROM '2014-09-30 12:00:00' )-29 and i1<=EXTRACT(DAY FROM '2014-09-30 12:00:00' )+600;
|
||||
select * from tbl1;
|
||||
--enable_parsing
|
||||
181
tools/deploy/mysql_test/t/update_range.test
Normal file
181
tools/deploy/mysql_test/t/update_range.test
Normal file
@ -0,0 +1,181 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: link.zt
|
||||
# owner group: SQL4
|
||||
# description: foobar
|
||||
####TITLE: range update
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
####CASE: single rowkey, using rowkey, >,>=,<,<=
|
||||
create table t1 (a int, b int, primary key (a));
|
||||
insert into t1(a,b) values(1,1),(2,1),(3,1),(4,1);
|
||||
update t1 set b=2 where a>0;
|
||||
select * from t1;
|
||||
update t1 set b=3 where a<5;
|
||||
select * from t1;
|
||||
update t1 set b=4 where a>1;
|
||||
update t1 set b=5 where a<4;
|
||||
select * from t1;
|
||||
update t1 set b=6 where a>=1;
|
||||
select * from t1;
|
||||
update t1 set b=7 where a<=5;
|
||||
select * from t1;
|
||||
update t1 set b=8 where a>0 and a<2;
|
||||
update t1 set b=9 where a>=2 and a<3;
|
||||
update t1 set b=10 where a>=3 and a<=4;
|
||||
select * from t1;
|
||||
update t1 set b=11 where a=1 or a=2 or a=3 or a=4;
|
||||
select * from t1;
|
||||
|
||||
####CASE: single rowkey, using non_rowkey, >, >=, <, <=
|
||||
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
|
||||
update t1 set b=b+1 where b>0;
|
||||
select * from t1;
|
||||
update t1 set b=b-1 where b<6;
|
||||
select * from t1;
|
||||
update t1 set b=5 where b>1;
|
||||
update t1 set b=6 where b<5;
|
||||
select * from t1;
|
||||
update t1 set b=7 where b>=1;
|
||||
select * from t1;
|
||||
update t1 set b=8 where b<=7;
|
||||
select * from t1;
|
||||
|
||||
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
|
||||
update t1 set b=10 where b>0 and b<2;
|
||||
update t1 set b=11 where b>=2 and b<3;
|
||||
update t1 set b=12 where b>=3 and b<=4;
|
||||
select * from t1;
|
||||
|
||||
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
|
||||
update t1 set b=11 where b=1 or b=2 or b=3 or b=4;
|
||||
select * from t1;
|
||||
|
||||
####CASE: single rowkey: using rowkey + non_rowkey, >, >=, <,<=, or
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, primary key(a));
|
||||
replace into t1(a,b) values(1,1),(2,2),(3,1),(4,2);
|
||||
update t1 set c=1 where a>0 and b>1;
|
||||
update t1 set c=2 where a<5 and b<2;
|
||||
select * from t1;
|
||||
|
||||
update t1 set c=3 where a>=0 and b<=1;
|
||||
update t1 set c=4 where a<=5 and b>=2;
|
||||
select * from t1;
|
||||
|
||||
update t1 set c=5 where a=0 or a=1 or a=2 or b=1;
|
||||
update t1 set c=6 where b=2 or a=1 or a=2;
|
||||
select * from t1;
|
||||
|
||||
replace into t1(a,b,c) values(1,1,NULL),(2,2,NULL),(3,3,NULL),(4,4,NULL);
|
||||
update t1 set c=1 where a<=1 or b>=4;
|
||||
update t1 set c=2 where a>1 or b<4;
|
||||
select * from t1;
|
||||
|
||||
####CASE: two rowkeys, using rowkey, >, >=, <, <=
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b));
|
||||
insert into t1(a,b,c,d) values(1,1,1,1),(2,2,1,1),(3,3,1,1);
|
||||
update t1 set c=c+1, d=d+1 where (a,b) > (0,0);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b) < (4,4);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b) >= (1,1);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b) <= (1,1);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b) in ((NULL,NULL),(0,0),(1,1),(2,2),(3,3),(4,4));
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b)=(1,1) or (a,b)=(2,2) or (a,b)=(3,3);
|
||||
select * from t1;
|
||||
update t1 set c=1, d=1 where (a,b) in ((1,1),(2,2),(3,3));
|
||||
update t1 set c=c+1, d=d+1 where (a,b,c,d) >= (1,1,1,1);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b,c,d) <= (3,3,3,3);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a,b,c,d)=(1,1,1,1) or (a,b,c,d)=(2,2,1,1) or (a,b,c,d)=(3,3,3,3);
|
||||
select * from t1;
|
||||
|
||||
####CASE: two rowkeys, using one of rowkey, =, >, >=, <, <=
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b));
|
||||
insert into t1(a,b,c,d) values(1,1,1,1),(1,2,1,1),(1,3,1,1);
|
||||
|
||||
update t1 set c=c+1, d=d+1 where a = 1;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where a > 0;
|
||||
update t1 set c=c+1, d=d+1 where a >=1 ;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where a < 4;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where a <= 1;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where a=1 or a=2 or a=3;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (a=1 or a=2 or a=3) and (b=1 or b=2);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where a>=1 and b>=2;
|
||||
select * from t1;
|
||||
|
||||
####CASE:two rowkeys, update using rowkey + non_rowkey, >, >=, <, <=, =
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b));
|
||||
replace into t1(a,b,c,d) values(1,1,1,1),(2,2,2,1),(3,3,3,1);
|
||||
|
||||
update t1 set d=d+1 where (a,b)>=(1,1) and c=1;
|
||||
select * from t1;
|
||||
update t1 set d=d+1 where (a,b)>=(1,1) and c=3;
|
||||
select * from t1;
|
||||
|
||||
update t1 set d=d+1 where (a=1 or a=2 or a=3) and c>=1;
|
||||
select * from t1;
|
||||
update t1 set d=d+1 where (a=1 or a=2 or a=3) and c<1;
|
||||
select * from t1;
|
||||
|
||||
update t1 set d=d+1 where (a=1 or a=2 or a=3) and (b=2 or b=3);
|
||||
select * from t1;
|
||||
update t1 set d=d+1 where (a=1 or a=2 or a=3) and (b=2 or b=3) and c=3;
|
||||
select * from t1;
|
||||
|
||||
update t1 set c=c+1, d=d+1 where a>=0 and a<=3 and b>1 and b<3;
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (c,d)>=(1,1);
|
||||
select * from t1;
|
||||
update t1 set c=c+1, d=d+1 where (b,a) > (1,1);
|
||||
select * from t1;
|
||||
|
||||
####CASE:multi rowkeys
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
#int
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b,c));
|
||||
insert into t1(a,b,c) values (1,1,1),(2,2,2),(3,3,3);
|
||||
update t1 set d=1 where (a,b,c)>(0,0,0) and (a,b,c)<=(3,3,3);
|
||||
select * from t1;
|
||||
#varchar
|
||||
create table t2(a varchar(1024), b varchar(1024), c varchar(1024), d varchar(1024), primary key(a,b,c));
|
||||
insert into t2(a,b,c) values ('a','a','a'),('b','b','b'),('c','c','c');
|
||||
update t2 set d='a' where (a,b,c)>=('a','a','b') and (a,b,c)<('b','b','c');
|
||||
select * from t2;
|
||||
#timestamp
|
||||
create table t3(a int, b varchar(1024), c timestamp(6) default "2012-01-01 12:00:00", d int, primary key(a,b,c));
|
||||
insert into t3(a,b,c) values (1,'a','2014-02-17'),(2,'b','2014-02-17'),(3,'c','2014-02-18');
|
||||
update t3 set d=1 where (a,b,c)>=(1,'a','2014-02-17 00:00:00') and (a,b,c)<=(2,'b','2014-02-18');
|
||||
select * from t3;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
370
tools/deploy/mysql_test/t/view.test
Normal file
370
tools/deploy/mysql_test/t/view.test
Normal file
@ -0,0 +1,370 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# description:
|
||||
#
|
||||
# 新建数据库作为测试环境,以下三句勿删
|
||||
--disable_warnings
|
||||
drop database if exists db_view;
|
||||
create database db_view;
|
||||
use db_view;
|
||||
|
||||
drop view if exists v_mix_tv, v_mix_1, v_mix_2, v_mix_3, vv_mix_1, vv_1, vvv_1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists view_v1, view_v2, view_v3, view_v4, view_v5, view_v6, view_v7;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists view_t1_not_null, view_t1_null_default, view_t1_not_null_default;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists view_v1_null_default, view_v1_not_null, view_v1_not_null_default;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists view_t1, view_t2, view_t3;
|
||||
--enable_warnings
|
||||
|
||||
set character_set_client = 45;
|
||||
|
||||
#
|
||||
# view test
|
||||
#
|
||||
create table view_t1(c1 int primary key, c2 int);
|
||||
create table view_t2(c3 int primary key, c4 int);
|
||||
create table view_t3(c1 int primary key, c2 int);
|
||||
|
||||
insert into view_t1 values(1, 11), (2, 12), (3, 13);
|
||||
insert into view_t2 values(10, 111), (20, 112), (30, 113);
|
||||
insert into view_t3 values(100, 1111), (200, 1112), (300, 1113);
|
||||
|
||||
############################################
|
||||
# debugging
|
||||
############
|
||||
#
|
||||
# error: dupl column name of 'c1'
|
||||
############################################
|
||||
#
|
||||
# nullable/defaultable
|
||||
#
|
||||
create table view_t1_not_null(c1 int primary key, c2 int not null);
|
||||
create table view_t1_null_default(c1 int primary key, c2 int default 22222);
|
||||
create table view_t1_not_null_default(c1 int primary key, c2 int not null default 2222);
|
||||
#create view view_v1_not_null as select * from view_t1_not_null;
|
||||
create view view_v1_not_null as select c1,c2 from view_t1_not_null;
|
||||
#create view view_v1_null_default as select * from view_t1_null_default;
|
||||
create view view_v1_null_default as select c1,c2 from view_t1_null_default;
|
||||
#create view view_v1_not_null_default as select * from view_t1_not_null_default;
|
||||
create view view_v1_not_null_default as select c1,c2 from view_t1_not_null_default;
|
||||
#
|
||||
## Bug
|
||||
#
|
||||
create table table_t8(c1 int null,c2 int not null);
|
||||
create view view_v8 as select c1+c2 from table_t8;
|
||||
desc view_v8;
|
||||
create view view_v9 as select c1+c2 from table_t8 a;
|
||||
desc view_v9;
|
||||
drop table table_t8;
|
||||
drop view view_v8;
|
||||
drop view view_v9;
|
||||
|
||||
#
|
||||
# other types (TODO)
|
||||
#
|
||||
#
|
||||
#
|
||||
# single table with columns and alias
|
||||
#
|
||||
#create or replace view view_v1 as select * from view_t1;
|
||||
create or replace view view_v1 as select c1,c2 from view_t1;
|
||||
select * from view_v1;
|
||||
create or replace view view_v2(c1, c2) as select c1, c2 from view_t1;
|
||||
select * from view_v2;
|
||||
create or replace view view_v3(c2) as select c2 from view_t1;
|
||||
select * from view_v3;
|
||||
#create or replace view view_v4(vc2) as select c2 from view_t1;
|
||||
create or replace view view_v4(vc2) as select c2 as vc2 from view_t1;
|
||||
select * from view_v4;
|
||||
#create or replace view view_v5(vc2) as select c2 as tc2 from view_t1;
|
||||
create or replace view view_v5(vc2) as select c2 as vc2 from view_t1;
|
||||
select * from view_v5;
|
||||
# todo select 1+5
|
||||
#
|
||||
# single table with mixed expr
|
||||
#
|
||||
create or replace view view_v6 as select c1+1 from view_t1;
|
||||
select * from view_v6;
|
||||
#create or replace view view_v7(vc1,vc2) as select c1+1 as tc1, c2+2 as tc2 from view_t1;
|
||||
create or replace view view_v7(vc1,vc2) as select c1+1 as vc1, c2+2 as vc2 from view_t1;
|
||||
select * from view_v7;
|
||||
#
|
||||
# multi-table with alias
|
||||
#
|
||||
#create or replace view v_2t_1 as select * from view_t1, view_t2;
|
||||
create or replace view v_2t_1 as select c1,c2,c3,c4 from view_t1, view_t2;
|
||||
--sorted_result
|
||||
select * from v_2t_1;
|
||||
# DUP
|
||||
#create or replace view v_2t_1 as select * from view_t1, view_t2;
|
||||
#create or replace view v_3t_1(vc1, vc2, vc3, vc4, vc5, vc6) as select * from view_t1, view_t2, view_t3;
|
||||
create or replace view v_3t_1(vc1, vc2, vc3, vc4, vc5, vc6) as select view_t1.c1 as vc1, view_t1.c2 as vc2, view_t2.c3 as vc3, view_t2.c4 as vc4, view_t3.c1 as vc5, view_t3.c2 as vc6 from view_t1, view_t2, view_t3;
|
||||
--sorted_result
|
||||
select * from v_3t_1;
|
||||
#
|
||||
# sub-view
|
||||
#
|
||||
#create or replace view vv_1 as select * from view_v1;
|
||||
create or replace view vv_1 as select c1,c2 from view_v1;
|
||||
--sorted_result
|
||||
select * from vv_1;
|
||||
#create or replace view vvv_1 as select * from vv_1;
|
||||
create or replace view vvv_1 as select c1,c2 from vv_1;
|
||||
--sorted_result
|
||||
select * from vvv_1;
|
||||
#
|
||||
# sub-view/table
|
||||
#
|
||||
# OB_ERR_COLUMN_DUPLICATE
|
||||
#create or replace view v_mix_tv as select * from view_v1, view_t1;
|
||||
|
||||
# mixed case with x1/x2 but different column names
|
||||
#create view v_mix_1 as select * from view_t1;
|
||||
create view v_mix_1 as select c1,c2 from view_t1;
|
||||
#create view vv_mix_1 as select * from v_mix_1, view_t2;
|
||||
create view vv_mix_1 as select c1,c2,c3,c4 from v_mix_1, view_t2;
|
||||
--sorted_result
|
||||
select * from (select * from (select * from view_t1) as v_test, view_t2) as vv_test;
|
||||
--sorted_result
|
||||
select * from vv_mix_1;
|
||||
# mixed case with x1/x3 but same column names
|
||||
#create or replace view v_mix_2(v_t1_c1, v_t1_c2) as select * from view_t1;
|
||||
#select * from v_mix_2;
|
||||
#create or replace view vv_mix_2 as select * from v_mix_2, view_t3;
|
||||
#select * from (select * from (select c1 v_t1_c1, c2 v_t1_c2 from view_t1) as v_test, view_t3) as vv_test;
|
||||
#select * from vv_mix_2;
|
||||
|
||||
#create or replace view v_mix_3 as select * from view_t1;
|
||||
create or replace view v_mix_3 as select c1,c2 from view_t1;
|
||||
--sorted_result
|
||||
select * from v_mix_3;
|
||||
#create or replace view vv_mix_3(vv_c1, vv_c2, vv_c3, vv_c4) as select * from v_mix_3, view_t3;
|
||||
#select * from (select v_test.c1 vv_c1, v_test.c2 vv_c2, view_t3.c1 vv_c3, view_t3.c2 vv_c4 from (select * from view_t1) as v_test, view_t3) as vv_test;
|
||||
#select * from vv_mix_3;
|
||||
#
|
||||
# view join table
|
||||
# Unknown column 'c1'
|
||||
#select * from vv_mix_3 join view_v6 on vv_mix_3.vv_c1=view_v6.c1+1;
|
||||
#
|
||||
# clean
|
||||
#
|
||||
--disable_warnings
|
||||
drop view if exists v_mix_tv, v_mix_1, v_mix_2, v_mix_3, vv_mix_1, vv_mix_2, vv_mix_3, vv_1, vvv_1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists v_2t_1, v_3t_1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists view_v1, view_v2, view_v3, view_v4, view_v5, view_v6, view_v7;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists view_t1_not_null, view_t1_null_default, view_t1_not_null_default;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists view_v1_null_default, view_v1_not_null, view_v1_not_null_default;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists view_t1, view_t2, view_t3;
|
||||
--enable_warnings
|
||||
#
|
||||
#drop view if exists xy1.view_v1, xy2.view_v2, xy3.view_v3;
|
||||
#drop view if exists xy1.view_v1, view_v2, xy3.view_v3;
|
||||
|
||||
# select_stmt with brackets or not
|
||||
--disable_warnings
|
||||
drop view if exists v1,v2,v3;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key);
|
||||
insert into t1 values(1),(2);
|
||||
#create view v1 as select * from t1;
|
||||
create view v1 as select c1 from t1;
|
||||
#$create view v2 as (select * from t1);
|
||||
create view v2 as (select c1 from t1);
|
||||
#create view v3 as ((select * from t1));
|
||||
create view v3 as ((select c1 from t1));
|
||||
insert into t1 values(3),(4);
|
||||
select * from v1;
|
||||
select * from v2;
|
||||
select * from v3;
|
||||
--disable_warnings
|
||||
drop view if exists v1,v2,v3;
|
||||
--enable_warnings
|
||||
#--error TODO xiyu
|
||||
#select * from v;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# Bug
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
create table t1(c1 varchar(10));
|
||||
insert into t1 value('test1');
|
||||
insert into t1 value('test2');
|
||||
create view v1 as select c1 from t1;
|
||||
--sorted_result
|
||||
select v1.c1 from v1 join t1 on v1.c1 = t1.c1;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v1;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
|
||||
#replace view
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int, c2 int);
|
||||
insert into t1 values(1,1);
|
||||
select * from t1;
|
||||
create or replace view v1 as select c1 from t1;
|
||||
select * from v1;
|
||||
#create or replace view v1 as select * from t1;
|
||||
create or replace view v1 as select c1,c2 from t1;
|
||||
select * from v1;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v1;
|
||||
--error 1050
|
||||
create view v1 as select c2 from t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
##
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
# schema
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(a int,b int);
|
||||
create view v as select c1,c2 from t1;
|
||||
create view vv as select c1,c2,a,b from v,t2;
|
||||
#create view vv as select * from t1;
|
||||
select * from v;
|
||||
select c1 from v;
|
||||
select * from vv;
|
||||
select c1 from vv;
|
||||
# drop column
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select * from v;
|
||||
--error 1356
|
||||
select * from vv;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c1 from vv;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select c2 from vv;
|
||||
# recover dropped column
|
||||
alter table t1 add column c2 int;
|
||||
select * from v;
|
||||
select * from vv;
|
||||
# drop table
|
||||
drop table t1;
|
||||
--error 1356
|
||||
select * from v;
|
||||
--error 1356
|
||||
select * from vv;
|
||||
# recover table with different column_type
|
||||
create table t1(c1 varchar(10), c2 datetime);
|
||||
select * from v;
|
||||
select * from vv;
|
||||
drop table t1;
|
||||
# recover table with different column_count
|
||||
create table t1(c1 varchar(10), c2 datetime, c3 int);
|
||||
select * from v;
|
||||
select * from vv;
|
||||
# insert and select
|
||||
drop table t1;
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1,10),(2,11);
|
||||
select * from v;
|
||||
select * from vv;
|
||||
drop table t1;
|
||||
create table t1(c1 varchar(10), c2 double, c3 int);
|
||||
insert into t1 values('hello', 100.10, 1),('hello', 100.11,2);
|
||||
select * from v;
|
||||
select * from v;
|
||||
drop table t1;
|
||||
drop view v;
|
||||
|
||||
create table t1(c1 int, c2 int);
|
||||
insert into t1 values(1,1), (2,2);
|
||||
create view v as select 5 from t1 order by 1;
|
||||
select * from v;
|
||||
create view v1 as select * from t1 where c1>'1';
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v, v1;
|
||||
|
||||
create view v as select 5, 6 from t1 order by 1,2;
|
||||
select * from v;
|
||||
drop view v;
|
||||
|
||||
create view v as select c1 + 1 from t1 order by 1;
|
||||
select * from v;
|
||||
drop view v;
|
||||
|
||||
create view v as select 7 + 3 from t1 order by 1;
|
||||
select * from v;
|
||||
drop view v;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int);
|
||||
insert into t1 values (1,1);
|
||||
create view v as select group_concat(b) from t1 group by a;
|
||||
select * from v;
|
||||
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
create table t1(c1 datetime, c2 int);
|
||||
insert into t1 values('1990-03-03 00:00:00', 2), ('2016-05-31 20:00:00', 3);
|
||||
create view v as select * from t1 where c1>'1990-04-01 00:00:00';
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v;
|
||||
select * from v;
|
||||
drop view if exists v;
|
||||
|
||||
drop table if exists t1;
|
||||
drop view if exists v1, v2;
|
||||
create table t1(col1 varchar(12) character set utf8mb4 collate utf8mb4_general_ci);
|
||||
insert into t1 values('t1_val');
|
||||
create view v1 as select 'v1_val' collate utf8mb4_general_ci as col1;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v1;
|
||||
create view v2 as select col1 from v1 union select col1 from t1;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v2;
|
||||
select coercibility(col1), collation(col1) from v2;
|
||||
# 本句勿删,且保证始终是该脚本的最后一行
|
||||
drop database if exists db_view;
|
||||
520
tools/deploy/mysql_test/t/view_2.test
Normal file
520
tools/deploy/mysql_test/t/view_2.test
Normal file
@ -0,0 +1,520 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# tags: optimizer
|
||||
# description:
|
||||
#
|
||||
--disable_warnings
|
||||
drop database if exists view;
|
||||
--enable_warnings
|
||||
create database view;
|
||||
use view;
|
||||
set character_set_client = 45;
|
||||
|
||||
#
|
||||
## test view schema weak-binding
|
||||
#
|
||||
|
||||
#simple
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v, vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int, c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
create view vv as select c1 from v;
|
||||
select c1, c2 from v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select c1, c2 from v;
|
||||
drop table t1;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select c1, c2 from v;
|
||||
create table t1(c1 int);
|
||||
--error 1356
|
||||
select c1 from vv;
|
||||
--error 1356
|
||||
select c2 from vv;
|
||||
--error 1356
|
||||
select c1, c2 from vv;
|
||||
--error 1356
|
||||
select 1 as a from vv;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v, vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int, c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
create view vv as select c2 from v;
|
||||
select c1, c2 from v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select c1, c2 from v;
|
||||
drop table t1;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select c1, c2 from v;
|
||||
create table t1(c1 int);
|
||||
--error 1356
|
||||
select c1 from vv;
|
||||
--error 1356
|
||||
select c2 from vv;
|
||||
--error 1356
|
||||
select c1, c2 from vv;
|
||||
--error 1356
|
||||
select c2, c1 from vv;
|
||||
--error 1356
|
||||
select 1 as a from vv;
|
||||
|
||||
#select * from view
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v,vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int ,c2 int);
|
||||
create table t2(c1 int ,c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
create view vv as select c1 from v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select * from v;
|
||||
--error 1356
|
||||
select v.* from v;
|
||||
--error 1356
|
||||
select * from vv;
|
||||
--error 1356
|
||||
select vv.* from vv;
|
||||
|
||||
#join on and using
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select v.c1 from v join t2 on v.c1 = t2.c1;
|
||||
--error 1356
|
||||
select v.c1 from v join t2 on v.c2 = t2.c2;
|
||||
--error 1356
|
||||
select v.c1 from v join t2 using(c1);
|
||||
--error 1356
|
||||
select v.c1 from v join t2 using(c2);
|
||||
|
||||
#column in where
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
select c1 from v where c2 = 1;
|
||||
select c1 from v where (select c2) = 1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v where c2 = 1;
|
||||
--error 1356
|
||||
select c1 from v where (select c2) = 1;
|
||||
|
||||
#column in order by
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
select c1 from v order by c2;
|
||||
select c1 from v order by (select c2);
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v order by c2;
|
||||
--error 1356
|
||||
select c1 from v order by (select c2);
|
||||
|
||||
#column in group by
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1, c2 from t1;
|
||||
select c1 from v group by c2;
|
||||
select c1 from v group by (select c2);
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v group by c2;
|
||||
--error 1356
|
||||
select c1 from v group by (select c2);
|
||||
|
||||
#column in having
|
||||
#drop table if exists t1,t2;
|
||||
#drop view if exists v;
|
||||
#create table t1(c1 int,c2 int);
|
||||
#create view v as select c1, c2 from t1;
|
||||
#select c1 from v having c2 = 1;
|
||||
#select c1 from v having (select c2) = 1;
|
||||
#alter table t1 drop column c2;
|
||||
#--error 1054
|
||||
#select c1 from v having c2 = 1;
|
||||
#--error 1356
|
||||
#select c1 from v having (select c2) = 1;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1,2),(2,3),(3,4);
|
||||
create view v as select c1,c2 from t1 order by c2;
|
||||
alter table t1 drop column c2;
|
||||
#order by 即使是从select里找到了c2(select中的c2不报错是因为view_stmt),因为select里面的c2也是无效列,因此最终结果也是视图无效
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1,2),(2,3),(3,4);
|
||||
create view v as select c1, -1 as c2 from t1 order by (select c2);
|
||||
select c1 from v;
|
||||
alter table t1 drop column c2;
|
||||
# a select c2提升上来之后从t1基础列里面找不到就直接报错,不会再去select_items找
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
# b (bug)
|
||||
#select c1 from (select c1, -1 as c2 from t1 order by (select c2)) v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1,c2 from t1 where c2=1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1,2),(2,3),(3,4);
|
||||
create view v as select c1, -1 as c2 from t1 order by (select c2);
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
|
||||
# agg
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1,sum(c2) from t1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
|
||||
#insert
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1,2),(2,3),(3,4),(4,5);
|
||||
create view v as select c1,c2 from t1;
|
||||
select * from v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
--error 1356
|
||||
select c2 from v;
|
||||
--error 1356
|
||||
select * from v;
|
||||
alter table t1 add column c2 int default 100;
|
||||
select * from v;
|
||||
alter table t1 alter column c2 set default 200;
|
||||
insert into t1(c1) values(5);
|
||||
select * from v;
|
||||
#alter table t1 change column c1 c1 varchar(20) default 'test';
|
||||
#insert into t1 values();
|
||||
#select * from v;
|
||||
|
||||
|
||||
#
|
||||
##test desc (show columns from table)
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create view v as select c1 from t1;
|
||||
desc v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create table t2(c1 int);
|
||||
create view v as (select c1 from t1) union (select c1 from t2);
|
||||
desc v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1,c2 from t1;
|
||||
desc v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
desc v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v,vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1,c2 from t1;
|
||||
create view vv as select c1,c2 from v;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
desc v;
|
||||
--error 1356
|
||||
desc vv;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v,vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select c1,c2 from t1;
|
||||
create view vv as select c1,c2 from v;
|
||||
create or replace view v as select c1 from t1;
|
||||
desc v;
|
||||
--error 1356
|
||||
desc vv;
|
||||
create or replace view vv as select c1 from v;
|
||||
desc vv;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4;
|
||||
drop view if exists v,vv;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
create table t3(c1 int,c2 int);
|
||||
create table t4(c1 int,c2 int);
|
||||
create view v as ((select * from t1) union (select c1,c2 from t2)) union (select * from t3);
|
||||
desc v;
|
||||
create view vv as (select * from v) union (select * from t4);
|
||||
desc vv;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
create view v as select c1,c2 from t1;
|
||||
select (select c2 from v limit 1) from t2;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select (select c2 from v limit 1) from t2;
|
||||
--error 1356
|
||||
select (select c3 from v limit 1) from t2;
|
||||
alter table t2 add column c3 int;
|
||||
--error 1356
|
||||
select (select c3 from v limit 1) from t2;
|
||||
|
||||
#
|
||||
##Bug
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists t1;
|
||||
drop table if exists v1,v2,v3;
|
||||
drop view if exists v1,v2,v3;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from v1;
|
||||
create view v3 as select * from v2;
|
||||
drop table t1;
|
||||
rename table v3 to t1;
|
||||
--error 1462
|
||||
select * from v1;
|
||||
--error 1462
|
||||
select * from v2;
|
||||
--error 1146
|
||||
select * from v3;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists t1,t2;
|
||||
drop table if exists v1,v2,v3;
|
||||
drop view if exists v1,v2,v3;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create table t2(c1 int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from t2;
|
||||
create view v3 as select v1.c1 as v1c1, v2.c1 as v2c1 from v1,v2;
|
||||
drop table t2;
|
||||
rename table v3 to t2;
|
||||
--error 1462
|
||||
select * from t2;
|
||||
--error 1462
|
||||
select * from v2;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists t1,t2;
|
||||
drop table if exists v1,v2;
|
||||
drop view if exists v1,v2;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create table t2(c1 int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select (select c1 from v1 limit 1) from t2;
|
||||
drop table t1;
|
||||
rename table v2 to t1;
|
||||
--error 1462
|
||||
select * from t1;
|
||||
--error 1462
|
||||
select * from v1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists t1;
|
||||
drop table if exists v1,v2,v3,v4;
|
||||
drop view if exists v1,v2,v3,v4;
|
||||
--enable_warnings
|
||||
create table t1(c1 int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from v1;
|
||||
create view v3 as select * from v2;
|
||||
create view v4 as select * from v2;
|
||||
drop view v1;
|
||||
rename table v4 to v1;
|
||||
--error 1462
|
||||
select * from v1;
|
||||
--error 1462
|
||||
select * from v2;
|
||||
--error 1462
|
||||
select * from v3;
|
||||
|
||||
#
|
||||
## Bug :
|
||||
## 主要测试在非select语句引用select_stmt(view展开)的问题,select结果作为其它stmt的输入暂时不支持,
|
||||
## 这里仅仅针对bug加入回归case
|
||||
#
|
||||
--error 1235
|
||||
SET optimizer_switch = (SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'optimizer_switch');
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
insert into t1(c1,c2) values(1,2),(2,3);
|
||||
create view v1 as select * from t1;
|
||||
insert into t2(c1,c2) select * from v1;
|
||||
select * from t2;
|
||||
|
||||
#Bug 对于基表schema失效的视图,查询成功后不应该有warning
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select * from t1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
show warnings;
|
||||
|
||||
#Bug 对于基表schema失效的视图,查询成功后不应该有warning
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
create view v as select * from t1;
|
||||
alter table t1 drop column c2;
|
||||
--error 1356
|
||||
select c1 from v;
|
||||
show warnings;
|
||||
|
||||
#Bug 创建视图中包含not exists子查询出错
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1(c1 int,c2 int);
|
||||
insert into t1 values(1, 1);
|
||||
create view v as select * from t1 where not exists(select * from t1 where c1>0);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v;
|
||||
select * from v;
|
||||
create view xy as select 123 from dual where not exists (select 1 from dual) limit 1;
|
||||
select * from xy;
|
||||
|
||||
#Bug 创建视图中包含union子句并且类型为char的时候长度出错
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1 (k int primary key, v1 int, v2 int);
|
||||
create table t2 (k int primary key, v1 char(1), v2 varchar(10));
|
||||
create view v as select k, v1, v2 from t1 union select k, v1, v2 from t2;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v;
|
||||
select * from v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
create table t1 (k int, v int);
|
||||
create view v as (select k, v from t1) union (select 1, 1 from t1);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view v;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
CREATE TABLE `t11` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, PRIMARY KEY (`a`) );
|
||||
CREATE TABLE `t21` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, PRIMARY KEY (`a`) );
|
||||
|
||||
--real_sleep 3
|
||||
explain extended_noaddr select t3.* from (select t11.a as X, t21.a as Y from t11 left join t21 on t11.a = t21.a) as t3 where t3.y is not null and t3.x > 10;
|
||||
drop database if exists view;
|
||||
11
tools/deploy/mysql_test/t/virtual_thread.test
Normal file
11
tools/deploy/mysql_test/t/virtual_thread.test
Normal file
@ -0,0 +1,11 @@
|
||||
# owner: fengshuo.fs
|
||||
# owner group: VOS
|
||||
# description: 简单测试__all_virtual_thread
|
||||
|
||||
connect (conn_sys,$OBMYSQL_MS0,root@sys,,test,$OBMYSQL_PORT);
|
||||
connection conn_sys;
|
||||
desc oceanbase.__all_virtual_thread;
|
||||
desc oceanbase.GV$OB_THREAD;
|
||||
## 避免漏设线程名,如果这里有结果,请使用set_thread_name设置线程名
|
||||
select count(1) from oceanbase.__all_virtual_thread where tname = "";
|
||||
select count(1) from oceanbase.V$OB_THREAD where tname = "observer";
|
||||
Reference in New Issue
Block a user