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
f96815fe
Commit
f96815fe
authored
Dec 14, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: unit resolution Item_field not yet accessible [fixes #398]
parent
1668efb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
+28
-6
mysql-test/suite/versioning/r/select.result
mysql-test/suite/versioning/r/select.result
+6
-0
mysql-test/suite/versioning/t/select.test
mysql-test/suite/versioning/t/select.test
+6
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-0
sql/table.cc
sql/table.cc
+12
-6
No files found.
mysql-test/suite/versioning/r/select.result
View file @
f96815fe
...
...
@@ -356,6 +356,12 @@ create or replace table t1 (a int, b int, key idx(a)) with system versioning;
insert into t1 values (1, 1), (2, 2);
select * from t1 where (a, 2) in ((1, 1), (2, 2)) and b = 1;
a b
### Issue #398, NOW is now non-magic
create or replace table t1 (x int) with system versioning;
select * from t1 for system_time as of current_timestamp;
x
select * from t1 for system_time as of now;
ERROR 42S22: Unknown column 'now' in 'where clause'
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(32);
...
...
mysql-test/suite/versioning/t/select.test
View file @
f96815fe
...
...
@@ -242,6 +242,12 @@ create or replace table t1 (a int, b int, key idx(a)) with system versioning;
insert
into
t1
values
(
1
,
1
),
(
2
,
2
);
select
*
from
t1
where
(
a
,
2
)
in
((
1
,
1
),
(
2
,
2
))
and
b
=
1
;
--
echo
### Issue #398, NOW is now non-magic
create
or
replace
table
t1
(
x
int
)
with
system
versioning
;
select
*
from
t1
for
system_time
as
of
current_timestamp
;
--
error
ER_BAD_FIELD_ERROR
select
*
from
t1
for
system_time
as
of
now
;
drop
view
v1
;
drop
table
t1
,
t2
;
...
...
sql/sql_select.cc
View file @
f96815fe
...
...
@@ -895,6 +895,10 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
if
(
vers_conditions
)
{
/* TODO: do resolve fix_length_and_dec(), fix_fields(). This requires
storing vers_conditions as Item and make some magic related to
UNIT_TIMESTAMP/UNIT_TRX_ID at stage of fix_fields()
(this is large refactoring). */
vers_conditions
.
resolve_units
(
timestamps_only
);
if
(
timestamps_only
&&
(
vers_conditions
.
unit_start
==
UNIT_TRX_ID
||
vers_conditions
.
unit_end
==
UNIT_TRX_ID
))
...
...
sql/table.cc
View file @
f96815fe
...
...
@@ -8879,15 +8879,21 @@ void vers_select_conds_t::resolve_units(bool timestamps_only)
DBUG_ASSERT
(
start
);
if
(
unit_start
==
UNIT_AUTO
)
{
unit_start
=
(
!
timestamps_only
&&
(
start
->
result_type
()
==
INT_RESULT
||
start
->
result_type
()
==
REAL_RESULT
))
?
UNIT_TRX_ID
:
UNIT_TIMESTAMP
;
if
(
start
->
type
()
==
Item
::
FIELD_ITEM
)
unit_start
=
UNIT_TIMESTAMP
;
else
unit_start
=
(
!
timestamps_only
&&
(
start
->
result_type
()
==
INT_RESULT
||
start
->
result_type
()
==
REAL_RESULT
))
?
UNIT_TRX_ID
:
UNIT_TIMESTAMP
;
}
if
(
end
&&
unit_end
==
UNIT_AUTO
)
{
unit_end
=
(
!
timestamps_only
&&
(
end
->
result_type
()
==
INT_RESULT
||
end
->
result_type
()
==
REAL_RESULT
))
?
UNIT_TRX_ID
:
UNIT_TIMESTAMP
;
if
(
start
->
type
()
==
Item
::
FIELD_ITEM
)
unit_start
=
UNIT_TIMESTAMP
;
else
unit_end
=
(
!
timestamps_only
&&
(
end
->
result_type
()
==
INT_RESULT
||
end
->
result_type
()
==
REAL_RESULT
))
?
UNIT_TRX_ID
:
UNIT_TIMESTAMP
;
}
}
...
...
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