From: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk> |
---|---|
To: | Michal Kalanski <kalanskim(at)zetokatowice(dot)pl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Dates in inserts |
Date: | 2003-04-01 13:15:17 |
Message-ID: | Pine.LNX.4.21.0304011408280.2573-100000@ponder.fairway2k.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 1 Apr 2003, Michal Kalanski wrote:
> Hello
>
> I have a table:
>
> CREATE TABLE public.dates (
> date timestamp
> )
>
> From psql I run following inserts:
>
> insert into dates values('13.01.03');
> insert into dates values('01.13.03');
>
> and I run select:
>
> select * from dates order by date;
>
> result:
>
> date
> ---------------------
> 2003-01-13 00:00:00
> 2003-01-13 00:00:00
> (2 rows)
>
> Why postgresql inserts the same dates ?
Probably becuase there is no 13th month so 01.13.03 can only be interpreted as
the 13th of January. Whereas your settings are probably such that 13.01.03 is
interpreted correctly as the 13th of January.
Well, it's that or the 01.13.03 is correctly interpreted and the 13.01.03 can
only be interpreted as the 13th as there is no 13th month.
Find out which it is by doing:
SELECT '02.01.03'::date
and checking your DATE STYLE setting. I'm not sure without looking what the
variable is that controls the interpretation of input but DATE STYLE is
probably a good point to start looking from.
Interestingly, doing the above select on my 7.3 doesn't show the time portion,
presumably you're using something older.
>
> Thanks a lot,
> Michal
--
Nigel J. Andrews
From | Date | Subject | |
---|---|---|---|
Next Message | Nigel J. Andrews | 2003-04-01 13:53:46 | dropping a table with dependencies |
Previous Message | Michal Kalanski | 2003-04-01 13:14:14 | Re: Dates in inserts |