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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bd13f197
Commit
bd13f197
authored
Aug 12, 2005
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-0
parents
7eebb751
82822612
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
mysql-test/r/view.result
mysql-test/r/view.result
+27
-0
mysql-test/t/view.test
mysql-test/t/view.test
+36
-0
sql/sql_base.cc
sql/sql_base.cc
+5
-2
No files found.
mysql-test/r/view.result
View file @
bd13f197
...
...
@@ -2065,3 +2065,30 @@ pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1)
2 c d
DROP VIEW v1;
DROP TABLE t1,t2;
CREATE TABLE t1 (id int PRIMARY KEY, f varchar(255));
CREATE VIEW v1 AS SELECT id, f FROM t1 WHERE id <= 2;
INSERT INTO t1 VALUES (2, 'foo2');
INSERT INTO t1 VALUES (1, 'foo1');
SELECT * FROM v1;
id f
1 foo1
2 foo2
SELECT * FROM v1;
id f
1 foo1
2 foo2
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (pk int PRIMARY KEY, b int);
CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
CREATE TABLE t3 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
CREATE TABLE t4 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
CREATE TABLE t5 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
CREATE VIEW v1 AS
SELECT t1.pk as a FROM t1,t2,t3,t4,t5
WHERE t1.b IS NULL AND
t1.pk=t2.fk AND t2.pk=t3.fk AND t3.pk=t4.fk AND t4.pk=t5.fk;
SELECT a FROM v1;
a
DROP VIEW v1;
DROP TABLE t1,t2,t3,t4,t5;
mysql-test/t/view.test
View file @
bd13f197
...
...
@@ -1901,3 +1901,39 @@ SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
#
# Test for bug #12382: SELECT * FROM view after INSERT command
#
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
,
f
varchar
(
255
));
CREATE
VIEW
v1
AS
SELECT
id
,
f
FROM
t1
WHERE
id
<=
2
;
INSERT
INTO
t1
VALUES
(
2
,
'foo2'
);
INSERT
INTO
t1
VALUES
(
1
,
'foo1'
);
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
#
# Test for bug #12470: crash for a simple select from a view defined
# as a join over 5 tables
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
b
int
);
CREATE
TABLE
t2
(
pk
int
PRIMARY
KEY
,
fk
int
,
INDEX
idx
(
fk
));
CREATE
TABLE
t3
(
pk
int
PRIMARY
KEY
,
fk
int
,
INDEX
idx
(
fk
));
CREATE
TABLE
t4
(
pk
int
PRIMARY
KEY
,
fk
int
,
INDEX
idx
(
fk
));
CREATE
TABLE
t5
(
pk
int
PRIMARY
KEY
,
fk
int
,
INDEX
idx
(
fk
));
CREATE
VIEW
v1
AS
SELECT
t1
.
pk
as
a
FROM
t1
,
t2
,
t3
,
t4
,
t5
WHERE
t1
.
b
IS
NULL
AND
t1
.
pk
=
t2
.
fk
AND
t2
.
pk
=
t3
.
fk
AND
t3
.
pk
=
t4
.
fk
AND
t4
.
pk
=
t5
.
fk
;
SELECT
a
FROM
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
;
sql/sql_base.cc
View file @
bd13f197
...
...
@@ -3181,6 +3181,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
List
<
Item
>
*
sum_func_list
,
bool
allow_sum_func
)
{
reg2
Item
*
item
;
bool
save_set_query_id
=
thd
->
set_query_id
;
List_iterator
<
Item
>
it
(
fields
);
DBUG_ENTER
(
"setup_fields"
);
...
...
@@ -3208,6 +3209,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if
(
!
item
->
fixed
&&
item
->
fix_fields
(
thd
,
it
.
ref
())
||
(
item
=
*
(
it
.
ref
()))
->
check_cols
(
1
))
{
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
}
if
(
ref
)
...
...
@@ -3215,8 +3217,9 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
&&
sum_func_list
)
item
->
split_sum_func
(
thd
,
ref_pointer_array
,
*
sum_func_list
);
thd
->
used_tables
|=
item
->
used_tables
();
thd
->
used_tables
|=
item
->
used_tables
();
}
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
test
(
thd
->
net
.
report_error
));
}
...
...
@@ -3657,6 +3660,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
arena
=
0
;
// For easier test
thd
->
set_query_id
=
1
;
select_lex
->
cond_count
=
0
;
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
{
...
...
@@ -3664,7 +3668,6 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
goto
err_no_arena
;
}
select_lex
->
cond_count
=
0
;
if
(
*
conds
)
{
thd
->
where
=
"where clause"
;
...
...
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