SELECT timestamp('2001-06-12'::date - '2000-06-12'::date)

Поиск
Список
Период
Сортировка
От Hans-Jürgen Schönig
Тема SELECT timestamp('2001-06-12'::date - '2000-06-12'::date)
Дата
Msg-id 3AFD8E75.A1E5115B@cybertec.at
обсуждение исходный текст
Ответы Re: SELECT timestamp('2001-06-12'::date - '2000-06-12'::date)
Список pgsql-sql
The "+" operator is not defined for (date, date) which seems very
logical to me since adding dates does in my opinion not make sense.
performance=# SELECT timestamp('2001-06-12'::date + '2000-06-12'::date);

ERROR:  Unable to identify an operator '+' for types 'date' and 'date'       You will have to retype this query using
anexplicit cast
 

Surprisingly "-" is defined for (date, date).
performance=# SELECT timestamp('2001-06-12'::date - '2000-06-12'::date);
      timestamp
------------------------1970-01-01 01:06:05+01
(1 row)

Does anybody understand the logic behind that operation and why is the
result not something like 1970-01-01 00:00:00?
   Hans



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

Предыдущее
От: "Sylte"
Дата:
Сообщение: Re: Informix->PostgreSQL database convertion
Следующее
От: Tom Lane
Дата:
Сообщение: Re: can't get rid of unnesesary SORT step in explain plan for hash join