problem with timeofday() function in cvs PostgreSQL

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

problem with timeofday() function in cvs PostgreSQL

От:
Pavel Stehule <stehule@kix.fsv.cvut.cz>
Дата:
Hello

In this version I can't convert returned value to time. timeofday() return 
text. I need convert to timestamp before. It is normal behavior? I 
expected timestamp as returned type.

regards

Pavel Stehule

Re: problem with timeofday() function in cvs PostgreSQL

От:
Dennis Björklund <db@zigo.dhs.org>
Дата:
On Fri, 8 Aug 2003, Pavel Stehule wrote:

> In this version I can't convert returned value to time. timeofday() return 
> text. I need convert to timestamp before. It is normal behavior? I 
> expected timestamp as returned type.

It is documented to return a string for historical reasons:

http://www.postgresql.org/docs/7.3/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

You probably want now() instead of that function.

-- 
/Dennis

Re: problem with timeofday() function in cvs PostgreSQL

От:
Pavel Stehule <stehule@kix.fsv.cvut.cz>
Дата:
On Fri, 8 Aug 2003, [ISO-8859-1] Dennis Björklund wrote:

> On Fri, 8 Aug 2003, Pavel Stehule wrote:
> 
> > In this version I can't convert returned value to time. timeofday() return 
> > text. I need convert to timestamp before. It is normal behavior? I 
> > expected timestamp as returned type.
> 
> It is documented to return a string for historical reasons:
> 
> http://www.postgresql.org/docs/7.3/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

This is good reason. Thank you.

> 
> You probably want now() instead of that function.
> 
 
I can't use now() or others because I need actual time in transaction.

Thank you
Pavel 

Re: problem with timeofday() function in cvs PostgreSQL

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Pavel Stehule  writes:
>> You probably want now() instead of that function.

> I can't use now() or others because I need actual time in transaction.

Just cast the result of timeofday() to timestamp (with time zone, likely).

			regards, tom lane
FAQ