Re: Help with SQL updating not working. - Mailing list pgsql-novice

From David G. Johnston
Subject Re: Help with SQL updating not working.
Date
Msg-id CAKFQuwayy0KcAhaKDv4wpaALBPLcJXk040UMXxkZ7LGBwuFhVQ@mail.gmail.com
Whole thread Raw
In response to Help with SQL updating not working.  (Paul Linehan <linehanp@tcd.ie>)
List pgsql-novice
On Mon, May 18, 2015 at 1:27 PM, Paul Linehan <linehanp@tcd.ie> wrote:

Now, into the time_diff field, I want to insert the time difference in seconds

I've tried various combinations of this

update the_times as  set time_diff = extract ('epoch' from
(the_times.time2 - the_times.time1)::interval)  from the_times;

but to no avail.

Could any kind soul help me out on this?
​​

SELECT extract('epoch' FROM te) - extract('epoch' FROM ts)
FROM (
VALUES ( '08:34:21'::time, '09:34:21'::time)
) tm (ts, te)

epoch ARE seconds; just subtract them directly.

David J.
 

pgsql-novice by date:

Previous
From: Daniel Begin
Date:
Subject: Re: Moving Database Cluster to another drive
Next
From: Andreas Kretschmer
Date:
Subject: Re: Help with SQL updating not working.