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
a196ccaf
Commit
a196ccaf
authored
Feb 13, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/mysql-5.1-opt
parents
273d016a
0461228a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
14 deletions
+52
-14
mysql-test/r/view.result
mysql-test/r/view.result
+18
-0
mysql-test/t/view.test
mysql-test/t/view.test
+26
-6
sql/sql_select.cc
sql/sql_select.cc
+8
-8
No files found.
mysql-test/r/view.result
View file @
a196ccaf
...
...
@@ -3098,6 +3098,24 @@ Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f1`,`test`.`t1`.`f2`
drop view v1;
drop table t1;
CREATE TABLE t1 (
id int(11) NOT NULL PRIMARY KEY,
country varchar(32),
code int(11) default NULL
);
INSERT INTO t1 VALUES
(1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT code, COUNT(DISTINCT country) FROM t1 GROUP BY code ORDER BY MAX(id);
code COUNT(DISTINCT country)
200 1
100 2
SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
code COUNT(DISTINCT country)
200 1
100 2
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
...
...
mysql-test/t/view.test
View file @
a196ccaf
...
...
@@ -748,12 +748,12 @@ drop view v1;
#
# VIEWs with national characters
#
create table t
(c
char);
create view v
as select c from t
;
insert into v
values ('
');
select * from v;
drop view v;
drop table t;
create table t
ü (cü
char);
create view v
ü as select cü from tü
;
insert into v
ü values ('ü
');
select * from v
ü
;
drop view v
ü
;
drop table t
ü
;
#
# problem with used_tables() of outer reference resolved in VIEW
...
...
@@ -3015,6 +3015,26 @@ explain extended select * from v1 order by f1;
drop
view
v1
;
drop
table
t1
;
#
# Bug#26209: queries with GROUP BY and ORDER BY using views
#
CREATE
TABLE
t1
(
id
int
(
11
)
NOT
NULL
PRIMARY
KEY
,
country
varchar
(
32
),
code
int
(
11
)
default
NULL
);
INSERT
INTO
t1
VALUES
(
1
,
'ITALY'
,
100
),(
2
,
'ITALY'
,
200
),(
3
,
'FRANCE'
,
100
),
(
4
,
'ITALY'
,
100
);
CREATE
VIEW
v1
AS
SELECT
*
FROM
t1
;
SELECT
code
,
COUNT
(
DISTINCT
country
)
FROM
t1
GROUP
BY
code
ORDER
BY
MAX
(
id
);
SELECT
code
,
COUNT
(
DISTINCT
country
)
FROM
v1
GROUP
BY
code
ORDER
BY
MAX
(
id
);
DROP
VIEW
v1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
...
...
sql/sql_select.cc
View file @
a196ccaf
...
...
@@ -12993,15 +12993,15 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
for
(;
order
;
order
=
order
->
next
,
pos
++
)
{
pos
->
field
=
0
;
pos
->
item
=
0
;
if
(
order
->
item
[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
pos
->
field
=
((
Item_field
*
)
(
*
order
->
item
))
->
field
;
else
if
(
order
->
item
[
0
]
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
!
order
->
item
[
0
]
->
const_item
())
pos
->
field
=
((
Item_sum
*
)
order
->
item
[
0
]
)
->
get_tmp_table_field
();
else
if
(
order
->
item
[
0
]
->
type
()
==
Item
::
COPY_STR_ITEM
)
Item
*
item
=
order
->
item
[
0
]
->
real_item
()
;
pos
->
field
=
0
;
pos
->
item
=
0
;
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
pos
->
field
=
((
Item_field
*
)
item
)
->
field
;
else
if
(
item
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
!
item
->
const_item
())
pos
->
field
=
((
Item_sum
*
)
item
)
->
get_tmp_table_field
();
else
if
(
item
->
type
()
==
Item
::
COPY_STR_ITEM
)
{
// Blob patch
pos
->
item
=
((
Item_copy_string
*
)
(
*
order
->
item
)
)
->
item
;
pos
->
item
=
((
Item_copy_string
*
)
item
)
->
item
;
}
else
pos
->
item
=
*
order
->
item
;
...
...
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