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
edd1417b
Commit
edd1417b
authored
Feb 08, 2006
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #17206 Update through VIEW is not working
parent
44f2bd57
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
5 deletions
+84
-5
mysql-test/r/ndb_view.result
mysql-test/r/ndb_view.result
+24
-0
mysql-test/t/ndb_view.test
mysql-test/t/ndb_view.test
+29
-0
sql/sql_base.cc
sql/sql_base.cc
+27
-5
sql/sql_partition.cc
sql/sql_partition.cc
+2
-0
sql/sql_view.cc
sql/sql_view.cc
+2
-0
No files found.
mysql-test/r/ndb_view.result
0 → 100644
View file @
edd1417b
DROP TABLE IF EXISTS t1,t2,t3;
DROP VIEW IF EXISTS v1,v2,v3;
create table t1 (a int, b int, c int, d int) engine=ndb;
insert into t1 values (1,2,3,4),(5,6,7,8);
create view v1 as select t1.c as a, t1.a as b, t1.d as c, t1.a+t1.b+t1.c as d from t1;
select * from v1 order by a,b,c;
a b c d
3 1 4 6
7 5 8 18
update v1 set a=a+100 where b=1;
select * from v1 order by a,b,c;
a b c d
7 5 8 18
103 1 4 106
drop view v1;
create view v1 as select t1.c as a from t1;
insert into v1 values (200);
select * from t1 order by a,b,c,d;
a b c d
NULL NULL 200 NULL
1 2 103 4
5 6 7 8
drop view v1;
drop table t1;
mysql-test/t/ndb_view.test
0 → 100644
View file @
edd1417b
--
source
include
/
have_ndb
.
inc
--
source
include
/
not_embedded
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
DROP
VIEW
IF
EXISTS
v1
,
v2
,
v3
;
--
enable_warnings
#
# simple operations via view
#
create
table
t1
(
a
int
,
b
int
,
c
int
,
d
int
)
engine
=
ndb
;
insert
into
t1
values
(
1
,
2
,
3
,
4
),(
5
,
6
,
7
,
8
);
create
view
v1
as
select
t1
.
c
as
a
,
t1
.
a
as
b
,
t1
.
d
as
c
,
t1
.
a
+
t1
.
b
+
t1
.
c
as
d
from
t1
;
select
*
from
v1
order
by
a
,
b
,
c
;
update
v1
set
a
=
a
+
100
where
b
=
1
;
select
*
from
v1
order
by
a
,
b
,
c
;
drop
view
v1
;
create
view
v1
as
select
t1
.
c
as
a
from
t1
;
insert
into
v1
values
(
200
);
select
*
from
t1
order
by
a
,
b
,
c
,
d
;
drop
view
v1
;
drop
table
t1
;
sql/sql_base.cc
View file @
edd1417b
...
@@ -3858,13 +3858,31 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
...
@@ -3858,13 +3858,31 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
register_tree_change
,
actual_table
);
register_tree_change
,
actual_table
);
}
}
if
(
fld
)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Check if there are sufficient access rights to the found field. */
/* Check if there are sufficient access rights to the found field. */
if
(
fld
&&
check_privileges
&&
if
(
check_privileges
&&
check_column_grant_in_table_ref
(
thd
,
*
actual_table
,
name
,
length
))
check_column_grant_in_table_ref
(
thd
,
*
actual_table
,
name
,
length
))
fld
=
WRONG_GRANT
;
fld
=
WRONG_GRANT
;
else
#endif
#endif
if
(
thd
->
set_query_id
)
{
Field
*
field_to_set
=
NULL
;
if
(
fld
==
view_ref_found
)
{
Item
*
it
=
(
*
ref
)
->
real_item
();
if
(
it
->
type
()
==
Item
::
FIELD_ITEM
)
field_to_set
=
((
Item_field
*
)
it
)
->
field
;
}
else
field_to_set
=
fld
;
if
(
field_to_set
)
field_to_set
->
table
->
file
->
ha_set_bit_in_rw_set
(
field_to_set
->
fieldnr
,
(
bool
)(
thd
->
set_query_id
-
1
));
}
}
DBUG_RETURN
(
fld
);
DBUG_RETURN
(
fld
);
}
}
...
@@ -5044,6 +5062,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
...
@@ -5044,6 +5062,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
DBUG_ENTER
(
"setup_fields"
);
DBUG_ENTER
(
"setup_fields"
);
thd
->
set_query_id
=
set_query_id
;
thd
->
set_query_id
=
set_query_id
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
if
(
allow_sum_func
)
if
(
allow_sum_func
)
thd
->
lex
->
allow_sum_func
|=
1
<<
thd
->
lex
->
current_select
->
nest_level
;
thd
->
lex
->
allow_sum_func
|=
1
<<
thd
->
lex
->
current_select
->
nest_level
;
thd
->
where
=
THD
::
DEFAULT_WHERE
;
thd
->
where
=
THD
::
DEFAULT_WHERE
;
...
@@ -5070,6 +5089,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
...
@@ -5070,6 +5089,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
{
{
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
thd
->
set_query_id
=
save_set_query_id
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
}
}
if
(
ref
)
if
(
ref
)
...
@@ -5081,6 +5101,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
...
@@ -5081,6 +5101,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
}
}
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
thd
->
lex
->
allow_sum_func
=
save_allow_sum_func
;
thd
->
set_query_id
=
save_set_query_id
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
DBUG_RETURN
(
test
(
thd
->
net
.
report_error
));
DBUG_RETURN
(
test
(
thd
->
net
.
report_error
));
}
}
...
@@ -5527,6 +5548,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
...
@@ -5527,6 +5548,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
arena
=
0
;
// For easier test
arena
=
0
;
// For easier test
thd
->
set_query_id
=
1
;
thd
->
set_query_id
=
1
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
select_lex
->
cond_count
=
0
;
select_lex
->
cond_count
=
0
;
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
...
...
sql/sql_partition.cc
View file @
edd1417b
...
@@ -1984,6 +1984,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
...
@@ -1984,6 +1984,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
}
}
thd
->
set_query_id
=
0
;
thd
->
set_query_id
=
0
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
/*
/*
Set-up the TABLE_LIST object to be a list with a single table
Set-up the TABLE_LIST object to be a list with a single table
Set the object to zero to create NULL pointers and set alias
Set the object to zero to create NULL pointers and set alias
...
@@ -2120,6 +2121,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
...
@@ -2120,6 +2121,7 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
result
=
FALSE
;
result
=
FALSE
;
end:
end:
thd
->
set_query_id
=
save_set_query_id
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
DBUG_RETURN
(
result
);
DBUG_RETURN
(
result
);
}
}
...
...
sql/sql_view.cc
View file @
edd1417b
...
@@ -1338,6 +1338,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
...
@@ -1338,6 +1338,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
*/
*/
bool
save_set_query_id
=
thd
->
set_query_id
;
bool
save_set_query_id
=
thd
->
set_query_id
;
thd
->
set_query_id
=
0
;
thd
->
set_query_id
=
0
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
for
(
Field_translator
*
fld
=
trans
;
fld
<
end_of_trans
;
fld
++
)
for
(
Field_translator
*
fld
=
trans
;
fld
<
end_of_trans
;
fld
++
)
{
{
if
(
!
fld
->
item
->
fixed
&&
fld
->
item
->
fix_fields
(
thd
,
&
fld
->
item
))
if
(
!
fld
->
item
->
fixed
&&
fld
->
item
->
fix_fields
(
thd
,
&
fld
->
item
))
...
@@ -1347,6 +1348,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
...
@@ -1347,6 +1348,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
}
}
}
}
thd
->
set_query_id
=
save_set_query_id
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_PRINT
(
"info"
,
(
"thd->set_query_id: %d"
,
thd
->
set_query_id
));
}
}
/* Loop over all keys to see if a unique-not-null key is used */
/* Loop over all keys to see if a unique-not-null key is used */
for
(;
key_info
!=
key_info_end
;
key_info
++
)
for
(;
key_info
!=
key_info_end
;
key_info
++
)
...
...
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