Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id IAA20398 for postgres-redist; Thu, 1 Sep 1994 08:53:30 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199409011553.IAA20398@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.37.53]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with ESMTP id IAA20388 for <postgres@postgres.Berkeley.EDU>; Thu, 1 Sep 1994 08:53:29 -0700
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.9/8.1B) with SMTP id IAA04507; Thu, 1 Sep 1994 08:53:06 -0700
Message-Id: <199409011553.IAA04507@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
From: aoki@cs.berkeley.edu (Paul M. Aoki)
To: "David Alan Nelson" <D.A.Nelson@newcastle.ac.uk>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Time Queries 
Reply-To: aoki@cs.berkeley.edu (Paul M. Aoki)
In-reply-to: Your message of Thu, 1 Sep 1994 14:03:39 +0100 (BST) 
	     <AA18254.9409011303@swinhoe.ncl.ac.uk> 
Date: Thu, 01 Sep 94 08:53:00 -0700
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-redist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Thu, 01 Sep 94 08:53:30 -0700
Resent-XMts: smtp

"David Alan Nelson" <D.A.Nelson@newcastle.ac.uk> writes:
> I have a table with a column in it storing time information, i.e. the 
> column has type abstime.  In Postgres 4.1, I need to be able to add
> a relative time amount on to this, i.e. using the syntax @ '7' "days",
> as stated in the reference manual.  
> I can not get this to work for either fields of type reltime or type
> abstime.  Can anybody tell me how to do this.

the only operator like this that's built in is timepl, which is 
abstime + reltime.  if you want others, you must write/register 
them yourself.

faerie:aoki (112)> monitor foo
Welcome to the POSTGRES terminal monitor

Go 
* create x (abst = abstime)\g

Query sent to backend is "create x (abst = abstime)"
CREATE
Go 
* append x (abst="now")\g

Query sent to backend is "append x (abst="now")"
APPEND 334138
Go 
* retrieve (x.all)\g

Query sent to backend is "retrieve (x.all)"
---------------
| abst        |
---------------
| Thu Sep 01 15:50:04 1994 GMT|
---------------

Go 
* retrieve (t = x.abst + "@ 7 days"::reltime)\g

Query sent to backend is "retrieve (t = x.abst + "@ 7 days"::reltime)"
---------------
| t           |
---------------
| Thu Sep 08 15:50:04 1994 GMT|
---------------

Go 
*  

--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
