BUG #7498: Questionable interval parsing when in the form 'n m days' - Mailing list pgsql-bugs

From daniel@heroku.com
Subject BUG #7498: Questionable interval parsing when in the form 'n m days'
Date
Msg-id E1T1mfh-0002ha-Rq@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #7498: Questionable interval parsing when in the form 'n m days'  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7498
Logged by:          Daniel Farina
Email address:      daniel@heroku.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 =3D '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;

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: psql doesn't reuse -p after backend fail
Next
From: Tom Lane
Date:
Subject: Re: Possible Bug in 9.2beta3