Re: [BUGS] Bug in date_part()

2001-01-18 Thread phil
Thanks for the reply Tom Lane, and Tom Lockhart. On my 7.0.3: phil=# select '4/1/2001'::date::timestamp; ?column? 2001-03-31 23:00:00-08 (1 row) This was built from source downloaded from the primary FTP site link on www.postgresql.org. [cartret@Sti

Re: [BUGS] Bug in date_part()

2001-01-17 Thread Tom Lane
[EMAIL PROTECTED] writes: > edge=# select date_part('dow','4/1/2001'::date)::int4; > ?column? > -- > 6 > (1 row) Seems to be fixed in current sources: regression=# select date_part('dow','4/1/2001'::date)::int4; ?column? -- 0 (1 row) I think this is a side-ef

[BUGS] Bug in date_part()

2001-01-17 Thread phil
Query to reproduce the bug (7.0.3): edge=# select date_part('dow','9/1/2001'::date)::int4; ?column? -- 6 (1 row) edge=# select date_part('dow','4/1/2001'::date)::int4; ?column? -- 6 (1 row) Clearly, the first of April and September are not both on the same

Re: [BUGS] BUG in date_part

2000-10-09 Thread Tom Lane
"Alexandru COSTIN" <[EMAIL PROTECTED]> writes: > I've discovered a bug in the date_part function. It returns 25 when > doing select date_part('day','2000-03-26'::date); Is 2000-03-26 a daylight savings changeover day where you live? If so, this is a known bug that's fixed for 7.1. date_part

Re: [BUGS] BUG in date_part

2000-10-09 Thread Bruce Momjian
[ Charset ISO-8859-1 unsupported, converting... ] > Hello, > I've discovered a bug in the date_part function. It returns 25 when > doing select date_part('day','2000-03-26'::date); > Anyway, this isn't happening if casting the date to timestamp > select date_part('day','2000-03-26'

[BUGS] BUG in date_part

2000-10-09 Thread Alexandru COSTIN
Hello, I've discovered a bug in the date_part function. It returns 25 when doing select date_part('day','2000-03-26'::date); Anyway, this isn't happening if casting the date to timestamp select date_part('day','2000-03-26'::timestamp); Alexander

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-08 Thread Thomas Lockhart
> Seems like you could just skip step 3 and call localtime() with fields > indicating midnight of the specified date. Then use the complete > localtime result (don't discard any fields) and you should be OK, no? OK, I have a solution which involves mktime(). As a side effect, I've stripped some

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-08 Thread Tom Lane
Thomas Lockhart <[EMAIL PROTECTED]> writes: >> Seems like you could just skip step 3 and call localtime() with fields >> indicating midnight of the specified date. Then use the complete >> localtime result (don't discard any fields) and you should be OK, no? > Pretty sure this won't work, since

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-07 Thread Thomas Lockhart
> Seems like you could just skip step 3 and call localtime() with fields > indicating midnight of the specified date. Then use the complete > localtime result (don't discard any fields) and you should be OK, no? Pretty sure this won't work, since the complete localtime result will not be local m

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-07 Thread Tom Lane
Thomas Lockhart <[EMAIL PROTECTED]> writes: > Looks to me like an off-by-one kind of problem in deciding which > timezone applies to midnight of a transition day. > 2) Convert to an integer "Unix system time". > 3) Rotate by 12 hours (to UTC noon!). This is supposed to ensure that we > s

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-07 Thread Thomas Lockhart
> >> Looks to me like an off-by-one kind of problem in deciding which > >> timezone applies to midnight of a transition day. > > The date->timestamp conversion code gets this right, so you might want > > to look at that. > Au contraire: the cited examples appear to prove that the > date->timestamp

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-06 Thread Tom Lane
Thomas Lockhart <[EMAIL PROTECTED]> writes: >> Looks to me like an off-by-one kind of problem in deciding which >> timezone applies to midnight of a transition day. > The date->timestamp conversion code gets this right, so you might want > to look at that. Au contraire: the cited examples appear

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-06 Thread Thomas Lockhart
> > it's not date_part() bug, it's to_date() bug: > Looks to me like an off-by-one kind of problem in deciding which > timezone applies to midnight of a transition day. Probably a bit worse (but no problem to solve ;): you need to make sure that you rotate the date type to the correct time z

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-06 Thread Karel Zak
> > Looks to me like an off-by-one kind of problem in deciding which > timezone applies to midnight of a transition day. > > regards, tom lane Hmm ... really cool solution. You are right! I was sure that in the my to_() code can't be bug :-)) Thanks.

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-06 Thread Tom Lane
Karel Zak <[EMAIL PROTECTED]> writes: > it's not date_part() bug, it's to_date() bug: > test=# select to_date('26.03.2000','dd.mm.')::timestamp; > ?column? > > 2000-03-25 23:00:00+01 > ^^^ >! Bug ! > test=# select to_timestamp('2

Re: [BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-06 Thread Karel Zak
> Sample Code > create table oops (date date); > > insert into oops (date) values (to_date('24.03.2000','dd.mm.')); > insert into oops (date) values (to_date('25.03.2000','dd.mm.')); > insert into oops (date) values (to_date('26.03.2000','dd.mm.')); > insert into oops (date) values (t

[BUGS] bug in date_part() function in 6.5.2, 7.0.2

2000-09-05 Thread pgsql-bugs
Alex Karpov ([EMAIL PROTECTED]) reports a bug with a severity of 1 The lower the number the more severe it is. Short Description bug in date_part() function in 6.5.2, 7.0.2 Long Description Checked on Postgres version 6.5.2 and 7.0.2: Incorrect DOW and DAY parts of date calculation. See exanple