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
7d20cad2
Commit
7d20cad2
authored
Jul 12, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
64c2a598
dc5949b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
mysql-test/r/view.result
mysql-test/r/view.result
+8
-0
mysql-test/t/view.test
mysql-test/t/view.test
+10
-0
sql/sql_base.cc
sql/sql_base.cc
+16
-6
No files found.
mysql-test/r/view.result
View file @
7d20cad2
...
...
@@ -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;
...
...
mysql-test/t/view.test
View file @
7d20cad2
...
...
@@ -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
#
...
...
sql/sql_base.cc
View file @
7d20cad2
...
...
@@ -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
...
...
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