Re: how to add 'time with time zone' data types and 'interval' data types

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: how to add 'time with time zone' data types and 'interval' data types
Дата
Msg-id
14757.1389112440@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
how to add 'time with time zone' data types and 'interval' data types avpro avpro <avprowebeden@gmail.com>
Re: how to add 'time with time zone' data types and 'interval' data types Andreas Kretschmer <akretschmer@spamfence.net>
Re: how to add 'time with time zone' data types and 'interval' data types avpro avpro <avprowebeden@gmail.com>
Re: how to add 'time with time zone' data types and 'interval' data types Kevin Grittner <kgrittn@ymail.com>
Re: how to add 'time with time zone' data types and 'interval' data types Tom Lane <tgl@sss.pgh.pa.us>
Re: how to add 'time with time zone' data types and 'interval' data types avpro avpro <avprowebeden@gmail.com>
Re: how to add 'time with time zone' data types and 'interval' data types David Johnston <polobo@yahoo.com>
Re: how to add 'time with time zone' data types and 'interval' data types Binand Sethumadhavan <binand@gmx.net>
Kevin Grittner  writes:
> avpro avpro  wrote:
>> select '12:00'::time - '9:00'::time; didn't work.

> I get this on 9.3:

> test=# select '12:00'::time - '9:00'::time;
> �?column? 
> ----------
> �03:00:00

Note that that yields an interval, not a time.  I think the OP may
be unhappy about the type mismatch.  He could just add a cast,
though.  In the addition case, casting one or both of the times to
interval might do what he wants, too, depending on whether he's
looking for wraparound behavior:

regression=# select '12:00'::time + '19:00'::time::interval;
 ?column? 
----------
 07:00:00
(1 row)

regression=# select '12:00'::time::interval + '19:00'::time::interval;
 ?column? 
----------
 31:00:00
(1 row)

			regards, tom lane

В списке pgsql-novice по дате отправления
От: Sameer Kumar
Дата:
От: Sergey Konoplev
Дата:
FAQ