BUG #4718: "select +'8:00'::interval;" gives an error

Started by Roman Kononovabout 17 years ago2 messagesbugs
Jump to latest
#1Roman Kononov
kononov@ftml.net

The following bug has been logged online:

Bug reference: 4718
Logged by: Roman Kononov
Email address: kononov@ftml.net
PostgreSQL version: 8.3.7
Operating system: GNU/Linux x86_64
Description: "select +'8:00'::interval;" gives an error
Details:

test=# select +'8:00'::interval;
ERROR: operator does not exist: + interval
LINE 1: select +'8:00'::interval;
^
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.

test=# select -'8:00'::interval;
-08:00:00

In reply to: Roman Kononov (#1)
Re: BUG #4718: "select +'8:00'::interval;" gives an error

Roman Kononov escreveu:

This is not a bug, but a missing feature.

test=# select +'8:00'::interval;
ERROR: operator does not exist: + interval
LINE 1: select +'8:00'::interval;
^
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.

You can solve it using:

euler=# select '+8:00'::interval;
interval
----------
08:00:00
(1 registro)

euler=# select '-8:00'::interval;
interval
-----------
-08:00:00
(1 registro)

As pointed by Tom in an ancient thread [1]http://archives.postgresql.org//pgsql-general/2003-09/msg00292.php, I agree that we could add + and @
unary operator for interval datatype. Unfortunately, such a patch has not been
proposed yet.

[1]: http://archives.postgresql.org//pgsql-general/2003-09/msg00292.php

--
Euler Taveira de Oliveira
http://www.timbira.com/