BUG #12872: Inconsistent processing of interval values

From: jan(dot)mate(at)inf-it(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12872: Inconsistent processing of interval values
Date: 2015-03-16 23:03:52
Message-ID: 20150316230352.2730.12684@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12872
Logged by: Jan Mate
Email address: jan(dot)mate(at)inf-it(dot)com
PostgreSQL version: 9.4.1
Operating system: Debian GNU/Linux 7
Description:

Postgresql 9.4 documentation says:

Interval values can be written using the following verbose syntax:

[(at)] quantity unit [quantity unit...] [direction]

but it works ONLY if a unit is used exactly once, e.g.:

testdb=> SELECT (now()-' +5 days -12 hours -1 second +1 week'::interval) AS
tstz;
tstz
-------------------------------
2015-03-05 11:36:08.646603+01
(1 row)

works, but:

testdb=> SELECT (now()-' +5 days -12 hours -1 second +1 day'::interval) AS
tstz;
ERROR: invalid input syntax for type interval: " +5 days -12 hours -1
second +1 day"
LINE 1: SELECT (now()-' +5 days -12 hours -1 second +1 day'::interva...

generates an error. Yes, I understand that writing '+5 days +1 day' is
"stupid" but it conforms the syntax in the documentation.

JM

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dennis Pozzi 2015-03-17 15:15:56 Re: Segfault on exclusion constraint violation
Previous Message Tom Lane 2015-03-16 14:22:32 Re: BUG #12869: PostGIS 2.2 can't compile against 9.5 dev branch