Обсуждение: Why does this work?

Поиск
Список
Период
Сортировка

Why does this work?

От
"Ian Harding"
Дата:
I accidentally formatted a string for tsearch before trying to cast it
to a date, and it worked!

 select 'June&15&2007'::date
    date
------------
 2007-06-15
(1 row)

Is this a happy accident, or is it OK to count on it continuing to
work this way?

Thanks,

Ian

Re: Why does this work?

От
Rodrigo De León
Дата:
On Jun 15, 1:56 pm, harding....@gmail.com ("Ian Harding") wrote:
> I accidentally formatted a string for tsearch before trying to cast it
> to a date, and it worked!
>
>  select 'June&15&2007'::date
>     date
> ------------
>  2007-06-15
> (1 row)
>
> Is this a happy accident, or is it OK to count on it continuing to
> work this way?
>
> Thanks,
>
> Ian

select
'June&15&2007'::date
,'June.15.2007'::date
,'June__15__2007'::date

See: http://www.postgresql.org/docs/8.2/static/x71171.html