Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function weekofyear returns results not according to the iso 8601 standard #3232

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2013-02-12 15:14:40 +0100
From: Alfred Nordman <<alfred.nordman>>
To: SQL devs <>
Version: 11.15.11 (Feb2013-SP3)
CC: @njnes

Last updated: 2013-09-30 11:22:58 +0200

Comment 18466

Date: 2013-02-12 15:14:40 +0100
From: Alfred Nordman <<alfred.nordman>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17
Build Identifier:

Results are seemed to be offseted by 1 year
DATE weekofyear ->ISO8601 weekofyear-> MonetDb
1-1-1986 1 1
1-1-1987 1 53
1-1-1988 53 52
1-1-1989 52 1
1-1-1990 1 1

Reproducible: Always

Steps to Reproduce:

  1. I used the following script as a text file
    create table weekofyear_test (d date);
    insert into weekofyear_test values ('1986-JAN-01');
    insert into weekofyear_test values ('1987-JAN-01');
    insert into weekofyear_test values ('1988-JAN-01');
    insert into weekofyear_test values ('1989-JAN-01');
    insert into weekofyear_test values ('1990-JAN-01');

select d, weekofyear(d) from weekofyear_test;
drop table weekofyear_test;

Actual Results:

d weekofyear
1-1-1986 1
1-1-1987 53
1-1-1988 52
1-1-1989 1
1-1-1990 1

Expected Results:

d weekofyear
1-1-1986 1
1-1-1987 1
1-1-1988 53
1-1-1989 52
1-1-1990 1

Comment 19070

Date: 2013-08-25 10:38:28 +0200
From: @njnes

Both dayofweek and weekofyear used sunday to saturday weeks, while iso wants the week to start on a monday.

Comment 19073

Date: 2013-08-25 16:23:37 +0200
From: MonetDB Mercurial Repository <>

Changeset 0620e9df2003 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=0620e9df2003

Changeset description:

fixed bug #3232, use dayofweek, starting at Monday
fixed bug #2962, convert timestamp with time zone to local time zone, when used as input to the extract functions.
fixed bug #2781, use correct time zone in mclient

Comment 19216

Date: 2013-09-30 11:22:58 +0200
From: MonetDB Mercurial Repository <>

Changeset fdd09b97b50b made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=fdd09b97b50b

Changeset description:

Properly extract week number from a given date.
Note that if Jan 1 is not on a Monday, it is in the same week as Dec
31 of the year before, and this can be either week 1 (if Jan 1 is on a
Tuesday, Wednesday, or Thursday) of week 52/53 (if it is on a Friday,
Saturday, or Sunday).
This fixes bug #3232 properly.
@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants