Re: type casting a subselect as an interval - Mailing list pgsql-general

From Karel Zak
Subject Re: type casting a subselect as an interval
Date
Msg-id 20030221111708.GB21668@zf.jcu.cz
Whole thread Raw
In response to type casting a subselect as an interval  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: type casting a subselect as an interval  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Fri, Feb 21, 2003 at 07:59:19PM +0900, Jean-Christian Imbeault wrote:
> How can I cast the return value of a sub-select as an interval?
>
> Something like:
>
> select current_timestamp - interval '(select days from T) days'

 You can cast it in the subselect:

 select current_timestamp - (select (days::text || 'd')::interval from T);

    Karel
--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

pgsql-general by date:

Previous
From: Jean-Christian Imbeault
Date:
Subject: type casting a subselect as an interval
Next
From: Andrew Sullivan
Date:
Subject: Re: Authentication to run pg_dump automatically