Casting varchar to interval

From: Chris <pgsql(at)cmulcahy(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Casting varchar to interval
Date: 2002-07-24 14:59:18
Message-ID: MWMail.pramtgee@host.none
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings:

I'm trying to store a timeout value into a settings table:
create table settings(
stattr varchar(25),
stvalue varchar(25));
insert into settings(stattr, stvalue) values ('timeout', '1 hr');

I would like to determine if this time has elapsed:
select selasthit - stvalue::interval as thetime from sessions, settings;
(obviously, there's only one row in my settings table for testing purposes)

I keep getting:
ERROR: Cannot cast type 'character varying' to 'interval'

Can anyone suggest a solution?

Thanks
Chris

Browse pgsql-general by date

  From Date Subject
Next Message miguel angel rojas aquino 2002-07-24 15:02:41 Re: error modifying max_connections (maybe a little o.t.)
Previous Message Elielson Fontanezi 2002-07-24 14:41:22 RES: [SQL] Queries not using Index