Re: Dates in inserts

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: Dates in inserts
Дата
Msg-id Pine.LNX.4.21.0304011408280.2573-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на Dates in inserts  ("Michal Kalanski" <kalanskim@zetokatowice.pl>)
Ответы Re: Dates in inserts  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: "Michal Kalanski"
Дата:
Сообщение: Re: Dates in inserts
Следующее
От: "Nigel J. Andrews"
Дата:
Сообщение: dropping a table with dependencies