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
5c5edbdd
Commit
5c5edbdd
authored
Jan 12, 2007
by
gluh@eagle.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
parents
cf41e1ec
7eebacad
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
3 deletions
+75
-3
mysql-test/r/join.result
mysql-test/r/join.result
+16
-0
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+10
-2
mysql-test/t/join.test
mysql-test/t/join.test
+18
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+16
-1
sql/item.cc
sql/item.cc
+2
-0
sql/sql_base.cc
sql/sql_base.cc
+13
-0
No files found.
mysql-test/r/join.result
View file @
5c5edbdd
...
...
@@ -804,3 +804,19 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than
Z
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
drop table t1, t2;
CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50));
CREATE TABLE t2 (Test_ID INTEGER);
CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1;
CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2
USING (Test_ID);
DESCRIBE tv1;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2
ON v1.Test_ID = t2.Test_ID;
DESCRIBE tv2;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
DROP VIEW v1;
DROP TABLE t1,t2,tv1,tv2;
End of 5.0 tests.
mysql-test/r/order_by.result
View file @
5c5edbdd
...
...
@@ -29,14 +29,14 @@ INSERT INTO t2 VALUES (7,'Liste des t2','t2_liste_form.phtml',51060,'link.gif');
INSERT INTO t2 VALUES (8,'Consulter les soumissions','consulter_soumissions.phtml',200,'link.gif');
INSERT INTO t2 VALUES (9,'Ajouter un type de materiel','typeMateriel_ajoute_form.phtml',51000,'link.gif');
INSERT INTO t2 VALUES (10,'Lister/modifier un type de materiel','typeMateriel_liste_form.phtml',51010,'link.gif');
INSERT INTO t2 VALUES (3,'Crer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif');
INSERT INTO t2 VALUES (3,'Cr
é
er une fiche de client','clients_ajoute_form.phtml',40000,'link.gif');
INSERT INTO t2 VALUES (4,'Modifier des clients','en_construction.html',40010,'link.gif');
INSERT INTO t2 VALUES (5,'Effacer des clients','en_construction.html',40020,'link.gif');
INSERT INTO t2 VALUES (6,'Ajouter un service','t2_ajoute_form.phtml',51050,'link.gif');
select t1.id,t1.idservice,t2.ordre,t2.description from t1, t2 where t1.id = 2 and t1.idservice = t2.id order by t2.ordre;
id idservice ordre description
2 1 10 Emettre un appel d'offres
2 3 40000 Crer une fiche de client
2 3 40000 Cr
é
er une fiche de client
2 4 40010 Modifier des clients
2 5 40020 Effacer des clients
2 6 51050 Ajouter un service
...
...
@@ -874,6 +874,14 @@ num (select num + 2 FROM t1 LIMIT 1)
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
ERROR 42S22: Unknown column 'num' in 'on clause'
DROP TABLE t1;
CREATE TABLE t1 (a int);
SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1;
val val1
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val;
ERROR 23000: Column 'val' in order clause is ambiguous
SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
ERROR 23000: Column 'val' in order clause is ambiguous
DROP TABLE t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
...
...
mysql-test/t/join.test
View file @
5c5edbdd
...
...
@@ -631,3 +631,21 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than
drop
table
t1
,
t2
;
# BUG#25106: A USING clause in combination with a VIEW results in column
# aliases ignored
#
CREATE
TABLE
t1
(
ID
INTEGER
,
Name
VARCHAR
(
50
));
CREATE
TABLE
t2
(
Test_ID
INTEGER
);
CREATE
VIEW
v1
(
Test_ID
,
Description
)
AS
SELECT
ID
,
Name
FROM
t1
;
CREATE
TABLE
tv1
SELECT
Description
AS
Name
FROM
v1
JOIN
t2
USING
(
Test_ID
);
DESCRIBE
tv1
;
CREATE
TABLE
tv2
SELECT
Description
AS
Name
FROM
v1
JOIN
t2
ON
v1
.
Test_ID
=
t2
.
Test_ID
;
DESCRIBE
tv2
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
,
tv1
,
tv2
;
--
echo
End
of
5.0
tests
.
mysql-test/t/order_by.test
View file @
5c5edbdd
...
...
@@ -44,7 +44,7 @@ INSERT INTO t2 VALUES (7,'Liste des t2','t2_liste_form.phtml',51060,'link.gif');
INSERT
INTO
t2
VALUES
(
8
,
'Consulter les soumissions'
,
'consulter_soumissions.phtml'
,
200
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
9
,
'Ajouter un type de materiel'
,
'typeMateriel_ajoute_form.phtml'
,
51000
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
10
,
'Lister/modifier un type de materiel'
,
'typeMateriel_liste_form.phtml'
,
51010
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
3
,
'Crer une fiche de client'
,
'clients_ajoute_form.phtml'
,
40000
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
3
,
'Cr
é
er une fiche de client'
,
'clients_ajoute_form.phtml'
,
40000
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
4
,
'Modifier des clients'
,
'en_construction.html'
,
40010
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
5
,
'Effacer des clients'
,
'en_construction.html'
,
40020
,
'link.gif'
);
INSERT
INTO
t2
VALUES
(
6
,
'Ajouter un service'
,
't2_ajoute_form.phtml'
,
51050
,
'link.gif'
);
...
...
@@ -588,6 +588,21 @@ SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1;
SELECT
a
.
a
+
1
AS
num
FROM
t1
a
JOIN
t1
b
ON
num
=
b
.
a
;
DROP
TABLE
t1
;
#
# Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously
#
CREATE
TABLE
t1
(
a
int
);
SELECT
p
.
a
AS
val
,
q
.
a
AS
val1
FROM
t1
p
,
t1
q
ORDER
BY
val
>
1
;
--
error
1052
SELECT
p
.
a
AS
val
,
q
.
a
AS
val
FROM
t1
p
,
t1
q
ORDER
BY
val
;
--
error
1052
SELECT
p
.
a
AS
val
,
q
.
a
AS
val
FROM
t1
p
,
t1
q
ORDER
BY
val
>
1
;
DROP
TABLE
t1
;
# End of 4.1 tests
create
table
t1
(
a
int
not
null
,
b
int
not
null
,
c
int
not
null
);
insert
t1
values
(
1
,
1
,
1
),(
1
,
1
,
2
),(
1
,
2
,
1
);
...
...
sql/item.cc
View file @
5c5edbdd
...
...
@@ -3732,6 +3732,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
Item
**
res
=
find_item_in_list
(
this
,
thd
->
lex
->
current_select
->
item_list
,
&
counter
,
REPORT_EXCEPT_NOT_FOUND
,
&
not_used
);
if
(
!
res
)
return
1
;
if
(
res
!=
(
Item
**
)
not_found_item
)
{
if
((
*
res
)
->
type
()
==
Item
::
FIELD_ITEM
)
...
...
sql/sql_base.cc
View file @
5c5edbdd
...
...
@@ -3801,6 +3801,19 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
column reference. See create_view_field() for details.
*/
item
=
nj_col
->
create_item
(
thd
);
/*
*ref != NULL means that *ref contains the item that we need to
replace. If the item was aliased by the user, set the alias to
the replacing item.
We need to set alias on both ref itself and on ref real item.
*/
if
(
*
ref
&&
!
(
*
ref
)
->
is_autogenerated_name
)
{
item
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
item
->
real_item
()
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
}
if
(
register_tree_change
&&
arena
)
thd
->
restore_active_arena
(
arena
,
&
backup
);
...
...
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