BUG #7498: Questionable interval parsing when in the form 'n m days'

From: daniel(at)heroku(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7498: Questionable interval parsing when in the form 'n m days'
Date: 2012-08-15 23:06:41
Message-ID: E1T1mfh-0002ha-Rq@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: 7498
Logged by: Daniel Farina
Email address: daniel(at)heroku(dot)com
PostgreSQL version: 9.1.4
Operating system: Ubuntu 12.04
Description:

This is an expression that should probably have an error and not evaluate to
"true":

select '1 5 hours'::interval = '1 day 5 hours'::interval;
?column?
----------
t
(1 row)

I think that the first spelling, a unit-less '1', should not be accepted.
Other unit combinations agree:

select '1 5 minutes'::interval;
ERROR: invalid input syntax for type interval: "1 5 minutes"
LINE 1: select '1 5 minutes'::interval;
^
select '1 5 months'::interval;
ERROR: invalid input syntax for type interval: "1 5 months"
LINE 1: select '1 5 months'::interval;
^
select '1 5 seconds'::interval;
ERROR: invalid input syntax for type interval: "1 5 seconds"
LINE 1: select '1 5 seconds'::interval;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2012-08-15 23:11:42 Re: [BUGS] BUG #6184: Inconsistencies in log messages
Previous Message Bruce Momjian 2012-08-15 23:06:12 Re: psql doesn't reuse -p after backend fail