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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7ed2c620
Commit
7ed2c620
authored
Apr 07, 2006
by
hartmut@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for wrong QUARTER calculation in EXTRACT() (Bug #18100)
parent
4ef7e5b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+36
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+18
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+1
-1
No files found.
mysql-test/r/func_time.result
View file @
7ed2c620
...
...
@@ -360,6 +360,42 @@ extract(SECOND FROM "1999-01-02 10:11:12")
select extract(MONTH FROM "2001-02-00");
extract(MONTH FROM "2001-02-00")
2
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
1968-01-20 03:14:08
...
...
mysql-test/t/func_time.test
View file @
7ed2c620
...
...
@@ -139,6 +139,24 @@ select extract(MINUTE_SECOND FROM "10:11:12");
select
extract
(
SECOND
FROM
"1999-01-02 10:11:12"
);
select
extract
(
MONTH
FROM
"2001-02-00"
);
#
# test EXTRACT QUARTER (Bug #18100)
#
SELECT
EXTRACT
(
QUARTER
FROM
'2004-01-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-02-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-03-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-04-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-05-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-06-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-07-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-08-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-09-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-10-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-11-15'
)
AS
quarter
;
SELECT
EXTRACT
(
QUARTER
FROM
'2004-12-15'
)
AS
quarter
;
#
# Test big intervals (Bug #3498)
#
...
...
sql/item_timefunc.cc
View file @
7ed2c620
...
...
@@ -2213,7 +2213,7 @@ longlong Item_extract::val_int()
switch
(
int_type
)
{
case
INTERVAL_YEAR
:
return
ltime
.
year
;
case
INTERVAL_YEAR_MONTH
:
return
ltime
.
year
*
100L
+
ltime
.
month
;
case
INTERVAL_QUARTER
:
return
ltime
.
month
/
3
+
1
;
case
INTERVAL_QUARTER
:
return
(
ltime
.
month
+
2
)
/
3
;
case
INTERVAL_MONTH
:
return
ltime
.
month
;
case
INTERVAL_WEEK
:
{
...
...
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