~ken-vandine/+junk/mysql-3.23.58

« back to all changes in this revision

Viewing changes to mysql-test/t/key.test

  • Committer: Ken VanDine
  • Date: 2018-01-27 03:45:15 UTC
  • Revision ID: ken.vandine@canonical.com-20180127034515-wpgsf0e7g0dq3qhv
init

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This failed for Elizabeth Mattijsen
 
3
#
 
4
 
 
5
drop table if exists t1,t2,t3;
 
6
CREATE TABLE t1 (
 
7
  ID CHAR(32) NOT NULL,
 
8
  name CHAR(32) NOT NULL,
 
9
  value CHAR(255),
 
10
  INDEX indexIDname (ID(8),name(8))
 
11
) ;
 
12
 
 
13
INSERT INTO t1 VALUES
 
14
('keyword','indexdir','/export/home/local/www/database/indexes/keyword');
 
15
INSERT INTO t1 VALUES ('keyword','urlprefix','text/ /text');
 
16
INSERT INTO t1 VALUES ('keyword','urlmap','/text/ /');
 
17
INSERT INTO t1 VALUES ('keyword','attr','personal employee company');
 
18
INSERT INTO t1 VALUES
 
19
('emailgids','indexdir','/export/home/local/www/database/indexes/emailgids');
 
20
INSERT INTO t1 VALUES ('emailgids','urlprefix','text/ /text');
 
21
INSERT INTO t1 VALUES ('emailgids','urlmap','/text/ /');
 
22
INSERT INTO t1 VALUES ('emailgids','attr','personal employee company');
 
23
 
 
24
SELECT value FROM t1 WHERE ID='emailgids' AND name='attr';
 
25
 
 
26
drop table t1;
 
27
 
 
28
#
 
29
# Problem with many key parts and many or
 
30
#
 
31
 
 
32
CREATE TABLE t1 (
 
33
  price int(5) DEFAULT '0' NOT NULL,
 
34
  area varchar(40) DEFAULT '' NOT NULL,
 
35
  type varchar(40) DEFAULT '' NOT NULL,
 
36
  transityes enum('Y','N') DEFAULT 'Y' NOT NULL,
 
37
  shopsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
 
38
  schoolsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
 
39
  petsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
 
40
  KEY price (price,area,type,transityes,shopsyes,schoolsyes,petsyes)
 
41
);
 
42
 
 
43
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
 
44
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
 
45
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
 
46
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
 
47
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
 
48
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
 
49
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
 
50
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
 
51
 
 
52
 SELECT * FROM t1 WHERE area='Vancouver' and transityes='y' and schoolsyes='y' and ( ((type='1 Bedroom' or type='Studio/Bach') and (price<=500)) or ((type='2 Bedroom') and (price<=550)) or ((type='Shared/Roomate') and (price<=300)) or ((type='Room and Board') and (price<=500)) ) and price <= 400;
 
53
 
 
54
drop table t1;
 
55
 
 
56
#
 
57
# problem med primary key
 
58
#
 
59
 
 
60
CREATE TABLE t1 (program enum('signup','unique','sliding') not null,  type enum('basic','sliding','signup'),  sites set('mt'),  PRIMARY KEY (program));
 
61
# The following should give an error for wrong primary key
 
62
!$1171 ALTER TABLE t1 modify program enum('signup','unique','sliding');
 
63
drop table t1;
 
64
 
 
65
#
 
66
# Test of compressed decimal index.
 
67
#
 
68
 
 
69
CREATE TABLE t1 (
 
70
  name varchar(50) DEFAULT '' NOT NULL,
 
71
  author varchar(50) DEFAULT '' NOT NULL,
 
72
  category decimal(10,0) DEFAULT '0' NOT NULL,
 
73
  email varchar(50),
 
74
  password varchar(50),
 
75
  proxy varchar(50),
 
76
  bitmap varchar(20),
 
77
  msg varchar(255),
 
78
  urlscol varchar(127),
 
79
  urlhttp varchar(127),
 
80
  timeout decimal(10,0),
 
81
  nbcnx decimal(10,0),
 
82
  creation decimal(10,0),
 
83
  livinguntil decimal(10,0),
 
84
  lang decimal(10,0),
 
85
  type decimal(10,0),
 
86
  subcat decimal(10,0),
 
87
  subtype decimal(10,0),
 
88
  reg char(1),
 
89
  scs varchar(255),
 
90
  capacity decimal(10,0),
 
91
  userISP varchar(50),
 
92
  CCident varchar(50) DEFAULT '' NOT NULL,
 
93
  PRIMARY KEY (name,author,category)
 
94
);
 
95
INSERT INTO t1 VALUES
 
96
('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai\nsalut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
 
97
INSERT INTO t1 VALUES
 
98
('LeNomDeMonSite','Marc',0,'m.barilley@cryo-networks.fr',NULL,NULL,NULL,NULL,'scol://195.242.78.119:Marc.LeNomDeMonSite',NULL,NULL,NULL,950560434,-881563214,NULL,3,0,3,'1','Pub/LeNomDeMonSite/domus_hibere.scs',NULL,'Marq','CC1');
 
99
select * from t1 where name='patnom' and author='patauteur' and category=0;
 
100
drop table t1;
 
101
 
 
102
#
 
103
# Problem with search on partial index
 
104
#
 
105
 
 
106
create table t1
 
107
(
 
108
  name_id int not null auto_increment,
 
109
  name blob,
 
110
  INDEX name_idx (name(5)),
 
111
  primary key (name_id)
 
112
);
 
113
 
 
114
INSERT t1 VALUES(NULL,'/');
 
115
INSERT t1 VALUES(NULL,'[T,U]_axpby');         
 
116
SELECT * FROM t1 WHERE name='[T,U]_axpy';
 
117
SELECT * FROM t1 WHERE name='[T,U]_axpby';
 
118
create table t2
 
119
(
 
120
  name_id int not null auto_increment,
 
121
  name char(255) binary,
 
122
  INDEX name_idx (name(5)),
 
123
  primary key (name_id)
 
124
);
 
125
INSERT t2 select * from t1;
 
126
SELECT * FROM t2 WHERE name='[T,U]_axpy';
 
127
SELECT * FROM t2 WHERE name='[T,U]_axpby';
 
128
drop table t1,t2;
 
129
 
 
130
#
 
131
# Test bug with long primary key
 
132
#
 
133
 
 
134
create table t1
 
135
(
 
136
   SEQNO                         numeric(12 ) not null,
 
137
   MOTYPEID                 numeric(12 ) not null,
 
138
   MOINSTANCEID     numeric(12 ) not null,
 
139
   ATTRID                       numeric(12 ) not null,
 
140
   VALUE                         varchar(120) not null,
 
141
   primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
 
142
);
 
143
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a'); 
 
144
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b'); 
 
145
!$1062 INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
 
146
drop table t1;
 
147
 
 
148
#
 
149
# Test with blob + tinyint key
 
150
# (Failed for Greg Valure)
 
151
#
 
152
 
 
153
CREATE TABLE t1 (
 
154
  a tinytext NOT NULL,
 
155
  b tinyint(3) unsigned NOT NULL default '0',
 
156
  PRIMARY KEY (a(32),b)
 
157
) TYPE=MyISAM;
 
158
INSERT INTO t1 VALUES ('a',1),('a',2);
 
159
SELECT * FROM t1 WHERE a='a' AND b=2;
 
160
SELECT * FROM t1 WHERE a='a' AND b in (2);
 
161
SELECT * FROM t1 WHERE a='a' AND b in (1,2);
 
162
drop table t1;