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
283c7dc8
Commit
283c7dc8
authored
Sep 07, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug12941
parents
854151fc
bebc6647
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
10 deletions
+79
-10
mysql-test/r/view.result
mysql-test/r/view.result
+26
-0
mysql-test/t/view.test
mysql-test/t/view.test
+33
-0
sql/sql_select.cc
sql/sql_select.cc
+20
-10
No files found.
mysql-test/r/view.result
View file @
283c7dc8
...
@@ -2151,3 +2151,29 @@ select * from v1;
...
@@ -2151,3 +2151,29 @@ select * from v1;
strcmp(f1,'a')
strcmp(f1,'a')
drop view v1;
drop view v1;
drop table t1;
drop table t1;
create table t1 (
r_object_id char(16) NOT NULL,
group_name varchar(32) NOT NULL
) engine = InnoDB;
create table t2 (
r_object_id char(16) NOT NULL,
i_position int(11) NOT NULL,
users_names varchar(32) default NULL
) Engine = InnoDB;
create view v1 as select r_object_id, group_name from t1;
create view v2 as select r_object_id, i_position, users_names from t2;
create unique index r_object_id on t1(r_object_id);
create index group_name on t1(group_name);
create unique index r_object_id_i_position on t2(r_object_id,i_position);
create index users_names on t2(users_names);
insert into t1 values('120001a080000542','tstgroup1');
insert into t2 values('120001a080000542',-1, 'guser01');
insert into t2 values('120001a080000542',-2, 'guser02');
select v1.r_object_id, v2.users_names from v1, v2
where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
order by users_names;
r_object_id users_names
120001a080000542 guser01
120001a080000542 guser02
drop view v1, v2;
drop table t1, t2;
mysql-test/t/view.test
View file @
283c7dc8
...
@@ -2018,3 +2018,36 @@ create view v1 as select strcmp(f1,'a') from t1;
...
@@ -2018,3 +2018,36 @@ create view v1 as select strcmp(f1,'a') from t1;
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
# BUG#12941
#
create
table
t1
(
r_object_id
char
(
16
)
NOT
NULL
,
group_name
varchar
(
32
)
NOT
NULL
)
engine
=
InnoDB
;
create
table
t2
(
r_object_id
char
(
16
)
NOT
NULL
,
i_position
int
(
11
)
NOT
NULL
,
users_names
varchar
(
32
)
default
NULL
)
Engine
=
InnoDB
;
create
view
v1
as
select
r_object_id
,
group_name
from
t1
;
create
view
v2
as
select
r_object_id
,
i_position
,
users_names
from
t2
;
create
unique
index
r_object_id
on
t1
(
r_object_id
);
create
index
group_name
on
t1
(
group_name
);
create
unique
index
r_object_id_i_position
on
t2
(
r_object_id
,
i_position
);
create
index
users_names
on
t2
(
users_names
);
insert
into
t1
values
(
'120001a080000542'
,
'tstgroup1'
);
insert
into
t2
values
(
'120001a080000542'
,
-
1
,
'guser01'
);
insert
into
t2
values
(
'120001a080000542'
,
-
2
,
'guser02'
);
select
v1
.
r_object_id
,
v2
.
users_names
from
v1
,
v2
where
(
v1
.
group_name
=
'tstgroup1'
)
and
v2
.
r_object_id
=
v1
.
r_object_id
order
by
users_names
;
drop
view
v1
,
v2
;
drop
table
t1
,
t2
;
sql/sql_select.cc
View file @
283c7dc8
...
@@ -8054,12 +8054,17 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -8054,12 +8054,17 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
bool
table_cant_handle_bit_fields
,
bool
table_cant_handle_bit_fields
,
uint
convert_blob_length
)
uint
convert_blob_length
)
{
{
Item
::
Type
orig_type
;
Item
*
orig_item
;
if
(
type
!=
Item
::
FIELD_ITEM
&&
if
(
type
!=
Item
::
FIELD_ITEM
&&
item
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
item
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
(
item
->
type
()
!=
Item
::
REF_ITEM
||
(
item
->
type
()
!=
Item
::
REF_ITEM
||
!
((
Item_ref
*
)
item
)
->
depended_from
))
!
((
Item_ref
*
)
item
)
->
depended_from
))
{
{
orig_item
=
item
;
item
=
item
->
real_item
();
item
=
item
->
real_item
();
orig_type
=
type
;
type
=
Item
::
FIELD_ITEM
;
type
=
Item
::
FIELD_ITEM
;
}
}
switch
(
type
)
{
switch
(
type
)
{
...
@@ -8075,29 +8080,34 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -8075,29 +8080,34 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case
Item
:
:
DEFAULT_VALUE_ITEM
:
case
Item
:
:
DEFAULT_VALUE_ITEM
:
{
{
Item_field
*
field
=
(
Item_field
*
)
item
;
Item_field
*
field
=
(
Item_field
*
)
item
;
bool
orig_modify
=
modify_item
;
Field
*
result
;
if
(
orig_type
==
Item
::
REF_ITEM
)
modify_item
=
0
;
/*
/*
If item have to be able to store NULLs but underlaid field can't do it,
If item have to be able to store NULLs but underlaid field can't do it,
create_tmp_field_from_field() can't be used for tmp field creation.
create_tmp_field_from_field() can't be used for tmp field creation.
*/
*/
if
(
field
->
maybe_null
&&
!
field
->
field
->
maybe_null
())
if
(
field
->
maybe_null
&&
!
field
->
field
->
maybe_null
())
{
{
Field
*
res
=
create_tmp_field_from_item
(
thd
,
item
,
table
,
NULL
,
result
=
create_tmp_field_from_item
(
thd
,
item
,
table
,
NULL
,
modify_item
,
convert_blob_length
);
modify_item
,
convert_blob_length
);
*
from_field
=
field
->
field
;
*
from_field
=
field
->
field
;
if
(
res
&&
modify_item
)
if
(
result
&&
modify_item
)
((
Item_field
*
)
item
)
->
result_field
=
res
;
((
Item_field
*
)
item
)
->
result_field
=
result
;
return
res
;
}
}
else
if
(
table_cant_handle_bit_fields
&&
field
->
field
->
type
()
==
FIELD_TYPE_BIT
)
result
=
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
if
(
table_cant_handle_bit_fields
&&
field
->
field
->
type
()
==
FIELD_TYPE_BIT
)
return
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
modify_item
,
convert_blob_length
);
modify_item
,
convert_blob_length
);
return
create_tmp_field_from_field
(
thd
,
(
*
from_field
=
field
->
field
),
else
result
=
create_tmp_field_from_field
(
thd
,
(
*
from_field
=
field
->
field
),
item
->
name
,
table
,
item
->
name
,
table
,
modify_item
?
(
Item_field
*
)
item
:
modify_item
?
(
Item_field
*
)
item
:
NULL
,
NULL
,
convert_blob_length
);
convert_blob_length
);
if
(
orig_type
==
Item
::
REF_ITEM
&&
orig_modify
)
((
Item_ref
*
)
orig_item
)
->
set_result_field
(
result
);
return
result
;
}
}
/* Fall through */
/* Fall through */
case
Item
:
:
FUNC_ITEM
:
case
Item
:
:
FUNC_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