Re: [SQL] interval as hours or minutes ?

2007-02-07 Thread Jan Muszynski
On 7 Feb 2007 at 19:03, Aarni Ruuhimäki wrote:

> Hi all,
>
> Could anyone please tell an easy way to get total hours or minutes from an
> interval ?
>
> SELECT SUM(stop_date_time - start_date_time) AS tot_time FROM work_times WHERE
> user_id = 1;
> tot_time
> -
>  2 days 14:08:44
>
> I'd like to have this like ... AS tot_hours ...
> tot_hours
> -
> 62
>
> and ... AS tot_minutes ...
> tot_minutes
> -
> 3728
>
> Maybe even ... AS tot_hours_minutes_seconds
> tot_hours_minutes_seconds
> -
> 62:08:44
>
>
> start_date_time and stop_date_time are stored as timestamp without time zone,
> using Pg 8.1.5 on CentOs 4.4


select extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp 
'2007-02-05
13:00:00')) as num_seconds;

 num_seconds

  185040
(1 row)

select (extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp 
'2007-02-05
13:00:00')) * interval '1 second') as hours_minutes_seconds;

 hours_minutes_seconds
---
 51:24:00
(1 row)

select extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp 
'2007-02-05
13:00:01'))/60 as minutes;

 minutes
--
 3083.983
(1 row)

select round(extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp 
'2007-02-05
13:00:01'))/60) as minutes;

 minutes
-
3084
(1 row)


select round(extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp 
'2007-02-05
13:00:01'))/360) as hours;

 hours
---
   514
(1 row)

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] metaphone and nysiis in postgres

2007-02-08 Thread Jan Muszynski
On 8 Feb 2007 at 10:59, Demel, Jeff wrote:

> I don't have a problem with doing this in our development environment,
> but when we go to move it onto the live production box, with all the
> live data and current custom settings, will a re-install cause issues?
> Data loss is unacceptable, of course, but it would also be nice if we
> don't have to juggle users, permissions, and settings.
> 
> -Jeff

Try looking in the share\contrib subdirectory of the install folder. 
Should be SQL files there to install/uninstall the contrib modules.
-jan

> 
> 
> -Original Message-
> From: Richard Huxton [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, February 08, 2007 3:06 AM
> To: Demel, Jeff
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] metaphone and nysiis in postgres
> 
> Demel, Jeff wrote:
> > Can this be installed easily on Windows?
> 
> Try re-running the installer, it should let you tick various options to
> install from contrib.
> 
> -- 
>Richard Huxton
>Archonet Ltd
> This email is intended only for the individual or entity to which it is 
> addressed.  This email may contain information that is privileged, 
> confidential or otherwise protected from disclosure. Dissemination, 
> distribution or copying of this e-mail or any attachments by anyone other 
> than the intended recipient, or an employee or agent responsible for 
> delivering the message to the intended recipient, is prohibited. If you are 
> not the intended recipient of this message or the employee or agent 
> responsible for delivery of this email to the intended recipient, please 
> notify the sender by replying to this message and then delete it from your 
> system.  Any use, dissemination, distribution, or reproduction of this 
> message by unintended recipients is strictly prohibited and may be unlawful.
> 
> ---(end of broadcast)---
> TIP 3: Have you checked our extensive FAQ?
> 
>http://www.postgresql.org/docs/faq



---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org