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
a57b8e13
Commit
a57b8e13
authored
Aug 12, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-having_resolve-4.1
parents
41c7760a
a1cb03c3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
14 deletions
+26
-14
mysql-test/r/derived.result
mysql-test/r/derived.result
+4
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+5
-1
sql/item_sum.cc
sql/item_sum.cc
+3
-2
sql/sql_derived.cc
sql/sql_derived.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+7
-7
sql/sql_select.h
sql/sql_select.h
+2
-1
sql/sql_union.cc
sql/sql_union.cc
+1
-1
sql/sql_update.cc
sql/sql_update.cc
+2
-1
No files found.
mysql-test/r/derived.result
View file @
a57b8e13
...
@@ -192,3 +192,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -192,3 +192,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x
1
mysql-test/t/derived.test
View file @
a57b8e13
...
@@ -88,5 +88,9 @@ SELECT d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matint
...
@@ -88,5 +88,9 @@ SELECT d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matint
explain
SELECT
d
.
pla_id
,
m2
.
mat_id
FROM
t1
m2
INNER
JOIN
(
SELECT
mp
.
pla_id
,
MIN
(
m1
.
matintnum
)
AS
matintnum
FROM
t2
mp
INNER
JOIN
t1
m1
ON
mp
.
mat_id
=
m1
.
mat_id
GROUP
BY
mp
.
pla_id
)
d
ON
d
.
matintnum
=
m2
.
matintnum
;
explain
SELECT
d
.
pla_id
,
m2
.
mat_id
FROM
t1
m2
INNER
JOIN
(
SELECT
mp
.
pla_id
,
MIN
(
m1
.
matintnum
)
AS
matintnum
FROM
t2
mp
INNER
JOIN
t1
m1
ON
mp
.
mat_id
=
m1
.
mat_id
GROUP
BY
mp
.
pla_id
)
d
ON
d
.
matintnum
=
m2
.
matintnum
;
explain
SELECT
d
.
pla_id
,
m2
.
test
FROM
t1
m2
INNER
JOIN
(
SELECT
mp
.
pla_id
,
MIN
(
m1
.
matintnum
)
AS
matintnum
FROM
t2
mp
INNER
JOIN
t1
m1
ON
mp
.
mat_id
=
m1
.
mat_id
GROUP
BY
mp
.
pla_id
)
d
ON
d
.
matintnum
=
m2
.
matintnum
;
explain
SELECT
d
.
pla_id
,
m2
.
test
FROM
t1
m2
INNER
JOIN
(
SELECT
mp
.
pla_id
,
MIN
(
m1
.
matintnum
)
AS
matintnum
FROM
t2
mp
INNER
JOIN
t1
m1
ON
mp
.
mat_id
=
m1
.
mat_id
GROUP
BY
mp
.
pla_id
)
d
ON
d
.
matintnum
=
m2
.
matintnum
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
#
# derived table reference
#
SELECT
a
.
x
FROM
(
SELECT
1
AS
x
)
AS
a
HAVING
a
.
x
=
1
;
sql/item_sum.cc
View file @
a57b8e13
...
@@ -1147,7 +1147,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
...
@@ -1147,7 +1147,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
list
,
(
ORDER
*
)
0
,
1
,
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
list
,
(
ORDER
*
)
0
,
1
,
0
,
0
,
select_lex
->
options
|
thd
->
options
,
select_lex
->
options
|
thd
->
options
,
HA_POS_ERROR
)))
HA_POS_ERROR
,
(
char
*
)
""
)))
return
1
;
return
1
;
table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
// Don't update rows
table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
// Don't update rows
table
->
no_rows
=
1
;
table
->
no_rows
=
1
;
...
@@ -1834,7 +1834,8 @@ bool Item_func_group_concat::setup(THD *thd)
...
@@ -1834,7 +1834,8 @@ bool Item_func_group_concat::setup(THD *thd)
(types, sizes and so on).
(types, sizes and so on).
*/
*/
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
all_fields
,
0
,
if
(
!
(
table
=
create_tmp_table
(
thd
,
tmp_table_param
,
all_fields
,
0
,
0
,
0
,
0
,
select_lex
->
options
|
thd
->
options
)))
0
,
0
,
0
,
select_lex
->
options
|
thd
->
options
,
(
char
*
)
""
)))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
table
->
no_rows
=
1
;
table
->
no_rows
=
1
;
...
...
sql/sql_derived.cc
View file @
a57b8e13
...
@@ -157,7 +157,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
...
@@ -157,7 +157,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
is_union
&&
!
unit
->
union_option
,
1
,
is_union
&&
!
unit
->
union_option
,
1
,
(
select_cursor
->
options
|
thd
->
options
|
(
select_cursor
->
options
|
thd
->
options
|
TMP_TABLE_ALL_COLUMNS
),
TMP_TABLE_ALL_COLUMNS
),
HA_POS_ERROR
)))
HA_POS_ERROR
,
org_table_list
->
alias
)))
{
{
res
=
-
1
;
res
=
-
1
;
goto
exit
;
goto
exit
;
...
...
sql/sql_select.cc
View file @
a57b8e13
...
@@ -787,7 +787,8 @@ JOIN::optimize()
...
@@ -787,7 +787,8 @@ JOIN::optimize()
group_list
&&
simple_group
,
group_list
&&
simple_group
,
select_options
,
select_options
,
(
order
==
0
||
skip_sort_order
)
?
select_limit
:
(
order
==
0
||
skip_sort_order
)
?
select_limit
:
HA_POS_ERROR
)))
HA_POS_ERROR
,
(
char
*
)
""
)))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
/*
/*
...
@@ -1120,7 +1121,8 @@ JOIN::exec()
...
@@ -1120,7 +1121,8 @@ JOIN::exec()
curr_join
->
select_distinct
&&
curr_join
->
select_distinct
&&
!
curr_join
->
group_list
,
!
curr_join
->
group_list
,
1
,
curr_join
->
select_options
,
1
,
curr_join
->
select_options
,
HA_POS_ERROR
)))
HA_POS_ERROR
,
(
char
*
)
""
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
curr_join
->
exec_tmp_table2
=
exec_tmp_table2
;
curr_join
->
exec_tmp_table2
=
exec_tmp_table2
;
}
}
...
@@ -4321,7 +4323,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -4321,7 +4323,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
TABLE
*
TABLE
*
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
ulong
select_options
,
ha_rows
rows_limit
)
ulong
select_options
,
ha_rows
rows_limit
,
char
*
table_alias
)
{
{
TABLE
*
table
;
TABLE
*
table
;
uint
i
,
field_count
,
reclength
,
null_count
,
null_pack_length
,
uint
i
,
field_count
,
reclength
,
null_count
,
null_pack_length
,
...
@@ -4410,10 +4413,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
...
@@ -4410,10 +4413,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table
->
field
=
reg_field
;
table
->
field
=
reg_field
;
table
->
blob_field
=
(
Field_blob
**
)
blob_field
;
table
->
blob_field
=
(
Field_blob
**
)
blob_field
;
table
->
real_name
=
table
->
path
=
tmpname
;
table
->
real_name
=
table
->
path
=
tmpname
;
/*
table
->
table_name
=
table_alias
;
This must be "" as field may refer to it after tempory table is dropped
*/
table
->
table_name
=
(
char
*
)
""
;
table
->
reginfo
.
lock_type
=
TL_WRITE
;
/* Will be updated */
table
->
reginfo
.
lock_type
=
TL_WRITE
;
/* Will be updated */
table
->
db_stat
=
HA_OPEN_KEYFILE
+
HA_OPEN_RNDFILE
;
table
->
db_stat
=
HA_OPEN_KEYFILE
+
HA_OPEN_RNDFILE
;
table
->
blob_ptr_size
=
mi_portable_sizeof_char_ptr
;
table
->
blob_ptr_size
=
mi_portable_sizeof_char_ptr
;
...
...
sql/sql_select.h
View file @
a57b8e13
...
@@ -274,7 +274,8 @@ void TEST_join(JOIN *join);
...
@@ -274,7 +274,8 @@ void TEST_join(JOIN *join);
bool
store_val_in_field
(
Field
*
field
,
Item
*
val
);
bool
store_val_in_field
(
Field
*
field
,
Item
*
val
);
TABLE
*
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
TABLE
*
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
ulong
select_options
,
ha_rows
rows_limit
);
ulong
select_options
,
ha_rows
rows_limit
,
char
*
alias
);
void
free_tmp_table
(
THD
*
thd
,
TABLE
*
entry
);
void
free_tmp_table
(
THD
*
thd
,
TABLE
*
entry
);
void
count_field_types
(
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
void
count_field_types
(
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
bool
reset_with_sum_func
);
bool
reset_with_sum_func
);
...
...
sql/sql_union.cc
View file @
a57b8e13
...
@@ -178,7 +178,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
...
@@ -178,7 +178,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
(
ORDER
*
)
0
,
!
union_option
,
(
ORDER
*
)
0
,
!
union_option
,
1
,
(
select_cursor
->
options
|
thd
->
options
|
1
,
(
select_cursor
->
options
|
thd
->
options
|
TMP_TABLE_ALL_COLUMNS
),
TMP_TABLE_ALL_COLUMNS
),
HA_POS_ERROR
)))
HA_POS_ERROR
,
(
char
*
)
""
)))
goto
err
;
goto
err
;
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
...
...
sql/sql_update.cc
View file @
a57b8e13
...
@@ -640,7 +640,8 @@ multi_update::initialize_tables(JOIN *join)
...
@@ -640,7 +640,8 @@ multi_update::initialize_tables(JOIN *join)
temp_fields
,
temp_fields
,
(
ORDER
*
)
&
group
,
0
,
0
,
(
ORDER
*
)
&
group
,
0
,
0
,
TMP_TABLE_ALL_COLUMNS
,
TMP_TABLE_ALL_COLUMNS
,
HA_POS_ERROR
)))
HA_POS_ERROR
,
(
char
*
)
""
)))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
tmp_tables
[
cnt
]
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
tmp_tables
[
cnt
]
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
}
}
...
...
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