Skip site navigation (1) Skip section navigation (2)

BUG #5728: Unexpected behavior comparing result of age() to an interval

From: "Dobes Vandermeer" <dobes(dot)vandermeer(at)kashoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5728: Unexpected behavior comparing result of age() to an interval
Date: 2010-10-26 21:45:35
Message-ID: 201010262145.o9QLjZ2k097528@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5728
Logged by:          Dobes Vandermeer
Email address:      dobes(dot)vandermeer(at)kashoo(dot)com
PostgreSQL version: 8.4
Operating system:   Windows
Description:        Unexpected behavior comparing result of age() to an
interval
Details: 

Seeing some surprising behavior with the use of age() and comparing the
result to an interval:

select current_date,
       age(current_date - interval '123 days') <= interval '120 days', 
       age(current_date - interval '122 days') <= interval '120 days', 
       age(current_date - interval '121 days') <= interval '120 days', 
       age(current_date - interval '120 days') <= interval '120 days', 
       age(current_date - interval '62 days') <= interval '60 days', 
       age(current_date - interval '61 days') <= interval '60 days', 
       age(current_date - interval '60 days') <= interval '60 days', 
       age(current_date - interval '30 days') <= interval '30 days';


Returns:

"2010-10-26";f;t;t;t;f;t;t;t

But I expected:

"2010-10-26";f;f;f;t;f;f;t;t

Something fishy there ...

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-10-27 00:47:55
Subject: Re: BUG #5728: Unexpected behavior comparing result of age() to an interval
Previous:From: Simon RiggsDate: 2010-10-26 21:16:02
Subject: Re: BUG #5727: Indexes broken in streaming replication

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group