> The following gave me wrong result:
> I am pretty sure date/time arithmetic on Postgres should be changed
> accordingly. Where can I start in postgres sources? Anyone to help?
I see the same symptom on my RH5.1 (glibc2) box here:
lockhart=> select datetime('today'::date);
datetime
----------------------------
Fri Dec 04 06:00:00 1998 MSK
(1 row)
Whereas my RH4.2 (libc5) box gets it right:
postgres=> select datetime('today'::date);
datetime
----------------------------
Fri Dec 04 00:00:00 1998 MSK
(1 row)
This isn't specific to your timezone; I see the same problem with
PST8PST. The routine actually getting invoked is date_datetime() in
backend/utils/adt/datetime.c. I would be reluctant to scatter
glibc2-specific bug-fix code throughout the date/time files (the issue
has come up before), but once we've identified the actual cause of the
problem we can consider a workaround.
To help look at the problem do a "make clean" in that directory, and
modify the Makefile to add to CFLAGS the argument "-DDATEDEBUG" which
will enable some print statements.
If it is a glibc2 bug then presumably someone will be applying a fix to
that fairly soon. If that is the case perhaps we can either
automatically test for the deficiency in configure or we can post the
fix as a patch rather than putting it into the main source tree.
btw, can you see a problem in the regression tests? I wonder if there
are other date/time routines which show problems. I don't usually run
Postgres regression tests on my RH5.1 box since that is at work...
- Tom
RH4.2 (libc-5.3.12):
postgres=> select datetime(current_date, '11:00');
datetime
----------------------------
Fri Dec 04 11:00:00 1998 MSK
(1 row)
postgres=> select 'now'::datetime;
?column?
----------------------------
Fri Dec 04 09:18:43 1998 MSK
(1 row)
RH5.1 (glibc-2.0.7):
lockhart=> select datetime(current_date, '11:00');
datetime
----------------------------
Fri Dec 04 17:00:00 1998 MSK
(1 row)
lockhart=> select 'now'::datetime;
?column?
----------------------------
Fri Dec 04 09:16:21 1998 MSK
(1 row)