Re: BUG #2977: dow doesn't conform to ISO-8601

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Adriaan van Os <postgres(at)microbizz(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2977: dow doesn't conform to ISO-8601
Date: 2007-03-27 19:08:12
Message-ID: 200703271908.l2RJ8Cc01792@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches


FYI, 8.3 will have an 'isodow' that conforms to ISO week start:

test=> select current_date-2, date_part('dow', current_date-2),
test-> date_part('isodow', current_date-2);
?column? | date_part | date_part
------------+-----------+-----------
2007-03-25 | 0 | 7
(1 row)

---------------------------------------------------------------------------

Adriaan van Os wrote:
>
> The following bug has been logged online:
>
> Bug reference: 2977
> Logged by: Adriaan van Os
> Email address: postgres(at)microbizz(dot)nl
> PostgreSQL version: 8.1.4
> Operating system: Mac OS X 10.4.6, intel
> Description: dow doesn't conform to ISO-8601
> Details:
>
> Section 9.9.1 of the Postgres docs
> <http://www.postgresql.org/docs/8.2/interactive/functions-datetime.html>
> mentions that the "week" subfield of the date_part function conforms to the
> ISO-8601 standard.
>
> The same ISO-8601 standard <http://www.omg.org/docs/ISO-stds/06-08-01.pdf>
> defines on page 9 in table-2 of section 3.2.2 that Monday is day 1 and
> Sunday day seven. However, the "dow" subfield of the date_part function
> returns 0 for Sunday.
>
> You can not, in the same function, ignore ISO-8601 for one subfield and
> follow it in another.
>
> Besides, if in the same week Sunday comes before Monday, how can the result
> of the "week" and "dow" fields conform to each other ?
>
> If "dow" can not be changed for reasons of backward compatibility, I suggest
> a new subfield "dayofweek" that does conform to the standard.
>
> Adriaan van Os
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2007-03-27 21:23:31 Re: "Permission denied" failures occurring on Windows
Previous Message Tom Lane 2007-03-27 14:33:00 Re: Partial index on varchar fields with IN

Browse pgsql-patches by date

  From Date Subject
Next Message Holger Schurig 2007-03-27 19:36:57 [PATCH] add CLUSTER table ORDER BY index
Previous Message Heikki Linnakangas 2007-03-27 18:18:20 Re: Numeric patch to add special-case representations for < 8 bytes