Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
68cb5f83
Commit
68cb5f83
authored
May 17, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
parents
ca9cdefe
eb2f3bad
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
122 additions
and
5 deletions
+122
-5
mysql-test/r/having.result
mysql-test/r/having.result
+1
-1
mysql-test/r/join_outer.result
mysql-test/r/join_outer.result
+37
-2
mysql-test/r/view.result
mysql-test/r/view.result
+25
-0
mysql-test/t/join_outer.test
mysql-test/t/join_outer.test
+18
-0
mysql-test/t/view.test
mysql-test/t/view.test
+28
-0
sql/item.cc
sql/item.cc
+10
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+3
-1
No files found.
mysql-test/r/having.result
View file @
68cb5f83
...
...
@@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where 0 having (
count(`test`.`t1`.`a`)
>= 0)
Note 1003 select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where 0 having (
`b`
>= 0)
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
...
...
mysql-test/r/join_outer.result
View file @
68cb5f83
...
...
@@ -1151,8 +1151,8 @@ EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%' OR FALSE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t
1 index PRIMARY,name name 23 NULL 3 Using where;
Using index
1 SIMPLE t
2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
1 SIMPLE t
2 index NULL fkey 5 NULL 5
Using index
1 SIMPLE t
1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2;
...
...
@@ -1176,3 +1176,38 @@ a b
3 3
DROP VIEW v1,v2;
DROP TABLE t1,t2;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
INSERT INTO t2 VALUES (2), (3);
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1);
a b
1 NULL
2 2
3 3
4 NULL
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1 OR 1);
a b
1 NULL
2 2
3 3
4 NULL
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (0 OR 1);
a b
1 NULL
2 2
3 3
4 NULL
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 2=2);
a b
1 NULL
2 2
3 3
4 NULL
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 1=0);
a b
1 NULL
2 2
3 3
4 NULL
DROP TABLE t1,t2;
mysql-test/r/view.result
View file @
68cb5f83
...
...
@@ -2660,3 +2660,28 @@ SELECT * FROM v1;
id t COUNT(*)
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(
fName varchar(25) NOT NULL,
lName varchar(25) NOT NULL,
DOB date NOT NULL,
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1(fName, lName, DOB) VALUES
('Hank', 'Hill', '1964-09-29'),
('Tom', 'Adams', '1908-02-14'),
('Homer', 'Simpson', '1968-03-05');
CREATE VIEW v1 AS
SELECT (year(now())-year(DOB)) AS Age
FROM t1 HAVING Age < 75;
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
Age
42
38
SELECT * FROM v1;
Age
42
38
DROP VIEW v1;
DROP TABLE t1;
mysql-test/t/join_outer.test
View file @
68cb5f83
...
...
@@ -805,3 +805,21 @@ SELECT v1.a, v2. b
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
;
#
# Bug 19816: LEFT OUTER JOIN with constant ORed predicates in WHERE clause
#
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t2
(
b
int
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
),
(
4
);
INSERT
INTO
t2
VALUES
(
2
),
(
3
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
b
WHERE
(
1
=
1
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
b
WHERE
(
1
OR
1
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
b
WHERE
(
0
OR
1
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
b
WHERE
(
1
=
1
OR
2
=
2
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
b
WHERE
(
1
=
1
OR
1
=
0
);
DROP
TABLE
t1
,
t2
;
mysql-test/t/view.test
View file @
68cb5f83
...
...
@@ -2528,3 +2528,31 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
#
# Bug #19573: VIEW with HAVING that refers an alias name
#
CREATE
TABLE
t1
(
fName
varchar
(
25
)
NOT
NULL
,
lName
varchar
(
25
)
NOT
NULL
,
DOB
date
NOT
NULL
,
uID
int
unsigned
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
);
INSERT
INTO
t1
(
fName
,
lName
,
DOB
)
VALUES
(
'Hank'
,
'Hill'
,
'1964-09-29'
),
(
'Tom'
,
'Adams'
,
'1908-02-14'
),
(
'Homer'
,
'Simpson'
,
'1968-03-05'
);
CREATE
VIEW
v1
AS
SELECT
(
year
(
now
())
-
year
(
DOB
))
AS
Age
FROM
t1
HAVING
Age
<
75
;
SHOW
CREATE
VIEW
v1
;
SELECT
(
year
(
now
())
-
year
(
DOB
))
AS
Age
FROM
t1
HAVING
Age
<
75
;
SELECT
*
FROM
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
sql/item.cc
View file @
68cb5f83
...
...
@@ -4840,7 +4840,16 @@ void Item_ref::cleanup()
void
Item_ref
::
print
(
String
*
str
)
{
if
(
ref
)
{
if
((
*
ref
)
->
type
()
!=
Item
::
CACHE_ITEM
&&
ref_type
()
!=
VIEW_REF
&&
name
&&
alias_name_used
)
{
THD
*
thd
=
current_thd
;
append_identifier
(
thd
,
str
,
name
,
(
uint
)
strlen
(
name
));
}
else
(
*
ref
)
->
print
(
str
);
}
else
Item_ident
::
print
(
str
);
}
...
...
sql/item_cmpfunc.cc
View file @
68cb5f83
...
...
@@ -2570,7 +2570,9 @@ Item_cond::fix_fields(THD *thd, Item **ref)
(
item
=
*
li
.
ref
())
->
check_cols
(
1
))
return
TRUE
;
/* purecov: inspected */
used_tables_cache
|=
item
->
used_tables
();
if
(
!
item
->
const_item
())
if
(
item
->
const_item
())
and_tables_cache
=
(
table_map
)
0
;
else
{
tmp_table_map
=
item
->
not_null_tables
();
not_null_tables_cache
|=
tmp_table_map
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment