| From: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> | 
|---|---|
| To: | "Denis V(dot) Osadchy" <osadchy(at)turbo(dot)nsk(dot)su> | 
| Cc: | pgsql-bugs(at)postgresql(dot)org | 
| Subject: | Re: Output of date_part('quarter', date) | 
| Date: | 2001-01-03 16:03:12 | 
| Message-ID: | 3A534D40.BD5216E8@fourpalms.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
> I tried to use function date_part('quarter', date) in query and I have
> got wrong results...
Yeesh! Don't know what I was thinking at the time, but it sure is wrong.
If you have PostgreSQL built from source, then you can fix this by
editing src/backend/utils/timestamp.c on or around line 2056. Change a
single line, just under the "case DTK_QUARTER:" from
result = (tm->tm_mon / 4) + 1;
to
result = ((tm->tm_mon - 1) / 3) + 1;
and you should start getting the right answer. Will be fixed in the next
release.
- Thomas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Lockhart | 2001-01-03 16:15:10 | Re: Output of date_part('quarter', date) | 
| Previous Message | pgsql-bugs | 2001-01-03 15:27:48 | impossible to create a table having the same name of a sequence object |