Re: Date math question - Mailing list pgsql-general

From Steve Crawford
Subject Re: Date math question
Date
Msg-id 492DCCFE.1060206@pinpointresearch.com
Whole thread Raw
In response to Date math question  (Kevin Kempter <kevink@consistentstate.com>)
List pgsql-general
Kevin Kempter wrote:
> Hi All;
>
> I have a table that contains 2 columns ts (a timestamp) and dursec (a float -
> number of seconds)
>
> I want to insert the following into another table:
>
> the ts (timestamp column) and a second date which is ts + dursec
>
> I tried these select variations with no luck:
>
> select ts, ts + interval dursec seconds from tmp2 limit 1;
>
> select ts, ts + 'seconds' dursec from tmp2 limit 1;
>
>
>
> Anyone know the correct syntax for this ?
>
Try

ts + dursec * '1 second'::interval

Cheers,
Steve

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: Odd on-update inconsistency
Next
From: "Webb Sprague"
Date:
Subject: Group by clause creating "ERROR: wrong record type supplied in RETURN NEXT" (version 8.1.11 -- grr...)