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
fec8dd87
Commit
fec8dd87
authored
Jul 12, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bkroot/mysql-5.0
into mysql.com:/home/bk/mysql-5.0
parents
e25b0390
c449f4d9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
108 additions
and
10 deletions
+108
-10
cmd-line-utils/libedit/chared.c
cmd-line-utils/libedit/chared.c
+2
-2
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+6
-0
mysql-test/r/view.result
mysql-test/r/view.result
+27
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+8
-0
mysql-test/t/view.test
mysql-test/t/view.test
+28
-0
sql/item.cc
sql/item.cc
+6
-2
sql/item.h
sql/item.h
+8
-0
sql/sql_base.cc
sql/sql_base.cc
+22
-6
sql/sql_view.cc
sql/sql_view.cc
+1
-0
No files found.
cmd-line-utils/libedit/chared.c
View file @
fec8dd87
...
...
@@ -51,13 +51,13 @@ cv_undo(EditLine *el)
{
c_undo_t
*
vu
=
&
el
->
el_chared
.
c_undo
;
c_redo_t
*
r
=
&
el
->
el_chared
.
c_redo
;
u
int
size
;
int
size
;
/* Save entire line for undo */
size
=
el
->
el_line
.
lastchar
-
el
->
el_line
.
buffer
;
vu
->
len
=
size
;
vu
->
cursor
=
el
->
el_line
.
cursor
-
el
->
el_line
.
buffer
;
memcpy
(
vu
->
buf
,
el
->
el_line
.
buffer
,
size
);
memcpy
(
vu
->
buf
,
el
->
el_line
.
buffer
,
(
size_t
)
size
);
/* save command info for redo */
r
->
count
=
el
->
el_state
.
doingarg
?
el
->
el_state
.
argument
:
0
;
...
...
mysql-test/r/subselect.result
View file @
fec8dd87
...
...
@@ -2837,3 +2837,9 @@ WHERE select_id = 0 OR select_id = 1);
values_id
1
DROP TABLE t1, t2;
create table t1 (fld enum('0','1'));
insert into t1 values ('1');
select * from (select max(fld) from t1) as foo;
max(fld)
1
drop table t1;
mysql-test/r/view.result
View file @
fec8dd87
...
...
@@ -1923,6 +1923,14 @@ ERROR HY000: Field of view 'test.v2' underlying table doesn't have a default val
set sql_mode=default;
drop view v2,v1;
drop table t1;
create table t1 (f1 int);
insert into t1 values (1);
create view v1 as select f1 from t1;
select f1 as alias from v1;
alias
1
drop view v1;
drop table t1;
CREATE TABLE t1 (s1 int, s2 int);
INSERT INTO t1 VALUES (1,2);
CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
...
...
@@ -1937,6 +1945,25 @@ ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1;
CALL p1();
s1 s2
1 2
DROP VIEW v1;
CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
CALL p1();
s1 s2
2 1
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (f1 char) ENGINE = innodb;
INSERT INTO t1 VALUES ('A');
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES('B');
SELECT * FROM v1;
f1
A
B
SELECT * FROM t1;
f1
A
B
DROP VIEW v1;
DROP TABLE t1;
mysql-test/t/subselect.test
View file @
fec8dd87
...
...
@@ -1859,3 +1859,11 @@ WHERE values_id IN (SELECT values_id FROM t2
WHERE
select_id
=
0
OR
select_id
=
1
);
DROP
TABLE
t1
,
t2
;
# BUG#11821 : Select from subselect using aggregate function on an enum
# segfaults:
create
table
t1
(
fld
enum
(
'0'
,
'1'
));
insert
into
t1
values
(
'1'
);
select
*
from
(
select
max
(
fld
)
from
t1
)
as
foo
;
drop
table
t1
;
mysql-test/t/view.test
View file @
fec8dd87
...
...
@@ -1762,6 +1762,16 @@ set sql_mode=default;
drop
view
v2
,
v1
;
drop
table
t1
;
#
# Bug#11399 Use an alias in a select statement on a view
#
create
table
t1
(
f1
int
);
insert
into
t1
values
(
1
);
create
view
v1
as
select
f1
from
t1
;
select
f1
as
alias
from
v1
;
drop
view
v1
;
drop
table
t1
;
#
# Test for bug #6120: SP cache to be invalidated when altering a view
#
...
...
@@ -1774,7 +1784,25 @@ CREATE PROCEDURE p1 () SELECT * FROM v1;
CALL
p1
();
ALTER
VIEW
v1
AS
SELECT
s1
AS
s1
,
s2
AS
s2
FROM
t1
;
CALL
p1
();
DROP
VIEW
v1
;
CREATE
VIEW
v1
AS
SELECT
s2
AS
s1
,
s1
AS
s2
FROM
t1
;
CALL
p1
();
DROP
PROCEDURE
p1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
#
# Test for bug #11771: wrong query_id in SELECT * FROM <view>
#
CREATE
TABLE
t1
(
f1
char
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
'A'
);
CREATE
VIEW
v1
AS
SELECT
*
FROM
t1
;
INSERT
INTO
t1
VALUES
(
'B'
);
SELECT
*
FROM
v1
;
SELECT
*
FROM
t1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
sql/item.cc
View file @
fec8dd87
...
...
@@ -5421,9 +5421,13 @@ void Item_type_holder::get_full_info(Item *item)
if
(
fld_type
==
MYSQL_TYPE_ENUM
||
fld_type
==
MYSQL_TYPE_SET
)
{
if
(
item
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
(((
Item_sum
*
)
item
)
->
sum_func
()
==
Item_sum
::
MAX_FUNC
||
((
Item_sum
*
)
item
)
->
sum_func
()
==
Item_sum
::
MIN_FUNC
))
item
=
((
Item_sum
*
)
item
)
->
args
[
0
];
/*
We can have enum/set type after merging only if we have one enum
/
set
field and number of NULL fields
We can have enum/set type after merging only if we have one enum
|
set
field
(or MIN|MAX(enum|set field))
and number of NULL fields
*/
DBUG_ASSERT
((
enum_set_typelib
&&
get_real_type
(
item
)
==
MYSQL_TYPE_NULL
)
||
...
...
sql/item.h
View file @
fec8dd87
...
...
@@ -641,6 +641,7 @@ class Item {
virtual
bool
cleanup_processor
(
byte
*
arg
);
virtual
bool
collect_item_field_processor
(
byte
*
arg
)
{
return
0
;
}
virtual
bool
change_context_processor
(
byte
*
context
)
{
return
0
;
}
virtual
bool
reset_query_id_processor
(
byte
*
query_id
)
{
return
0
;
}
virtual
Item
*
equal_fields_propagator
(
byte
*
arg
)
{
return
this
;
}
virtual
Item
*
set_no_const_sub
(
byte
*
arg
)
{
return
this
;
}
...
...
@@ -895,6 +896,13 @@ class Item_field :public Item_ident
bool
is_null
()
{
return
field
->
is_null
();
}
Item
*
get_tmp_table_item
(
THD
*
thd
);
bool
collect_item_field_processor
(
byte
*
arg
);
bool
reset_query_id_processor
(
byte
*
arg
)
{
field
->
query_id
=
*
((
query_id_t
*
)
arg
);
if
(
result_field
)
result_field
->
query_id
=
field
->
query_id
;
return
0
;
}
void
cleanup
();
Item_equal
*
find_item_equal
(
COND_EQUAL
*
cond_equal
);
Item
*
equal_fields_propagator
(
byte
*
arg
);
...
...
sql/sql_base.cc
View file @
fec8dd87
...
...
@@ -2400,9 +2400,11 @@ Field *view_ref_found= (Field*) 0x2;
name name of field
item_name name of item if it will be created (VIEW)
length length of name
ref
expression substituted in VIEW should be
ref
[in/out]
expression substituted in VIEW should be
passed using this reference (return
view_ref_found)
(*ref != NULL) only if *ref contains
the item that we need to replace.
check_grants_table do check columns grants for table?
check_grants_view do check columns grants for view?
allow_rowid do allow finding of "_rowid" field?
...
...
@@ -2440,11 +2442,6 @@ find_field_in_table(THD *thd, TABLE_LIST *table_list,
{
if
(
!
my_strcasecmp
(
system_charset_info
,
field_it
.
name
(),
name
))
{
Item
*
item
=
field_it
.
create_item
(
thd
);
if
(
!
item
)
{
DBUG_RETURN
(
0
);
}
if
(
table_list
->
schema_table_reformed
)
{
/*
...
...
@@ -2463,6 +2460,19 @@ find_field_in_table(THD *thd, TABLE_LIST *table_list,
name
,
length
))
DBUG_RETURN
(
WRONG_GRANT
);
#endif
Item
*
item
=
field_it
.
create_item
(
thd
);
if
(
!
item
)
{
DBUG_RETURN
(
0
);
}
/*
*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.
*/
if
(
*
ref
&&
!
(
*
ref
)
->
is_autogenerated_name
)
item
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
if
(
register_tree_change
)
thd
->
change_item_tree
(
ref
,
item
);
else
...
...
@@ -3495,6 +3505,12 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
field
->
query_id
=
thd
->
query_id
;
table
->
used_keys
.
intersect
(
field
->
part_of_key
);
}
else
{
Item
*
item
=
((
Field_iterator_view
*
)
iterator
)
->
item
();
item
->
walk
(
&
Item
::
reset_query_id_processor
,
(
byte
*
)(
&
thd
->
query_id
));
}
}
/*
All fields are used in case if usual tables (in case of view used
...
...
sql/sql_view.cc
View file @
fec8dd87
...
...
@@ -1004,6 +1004,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
if
(
my_delete
(
path
,
MYF
(
MY_WME
)))
goto
err
;
query_cache_invalidate3
(
thd
,
view
,
0
);
sp_cache_invalidate
();
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
send_ok
(
thd
);
...
...
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