Thread: Wrong date inserts

Wrong date inserts

From
Egon Reetz
Date:
Hello,

database is 7.1.3, compiled with -enable-local -enable-recode
-enable-multibyte=UNICODE,
initdb -E UNICODE, createdb -E LATIN1.

I have a table with 2 date fields (start_date, end_date).

When I do: insert into my_table values ('12.04.2002', '31.08.2002');
I'm getting with select * from my_table:
2002-12-04 | 2002-08-31

It looks like day and month are exchanged, when the day is less or equal
12. Is this a known behavior? Anyone has an experiance like this with
7.2.1?

Thanks

Egon








Re: Wrong date inserts

From
Tom Lane
Date:
Egon Reetz <reetz@usco.de> writes:
> It looks like day and month are exchanged, when the day is less or equal
> 12.

Sounds like you should change DateStyle to tell the truth about the date
format you are using.  The system has to rely on that when the field
values don't make it obvious which component is which.

Looks like you want 'German' datestyle for this input.

            regards, tom lane

Re: Wrong date inserts

From
Egon Reetz
Date:
Well, will look forward to find something about DateStyle, but
shouldn't both dates handled equally.
Same input format should result into the same result, shouldn't it?

Regards

Egon

Am Sonntag den, 14. April 2002, um 19:06, schrieb Tom Lane:

> Egon Reetz <reetz@usco.de> writes:
>> It looks like day and month are exchanged, when the day is less or
>> equal
>> 12.
>
> Sounds like you should change DateStyle to tell the truth about the date
> format you are using.  The system has to rely on that when the field
> values don't make it obvious which component is which.
>
> Looks like you want 'German' datestyle for this input.
>
>             regards, tom lane
>


Re: Wrong date inserts

From
"Serguei Mokhov"
Date:
----- Original Message -----
From: "Egon Reetz" <reetz@usco.de>
Sent: Sunday, April 14, 2002 7:26 AM


> database is 7.1.3, compiled with -enable-local -enable-recode
                                   ^^^^^^^^^^^^^
Is it possible that this was just a spelling mistake?
--enable-locale

-s