Subject: Time Queries

From: "David Alan Nelson" <[email-masked]>
Date: Thu, 1 Sep 1994 14:03:39 +0100 (BST)

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.

Cheers

Dave
-- 

Mail ID : [email-masked]

Computing Science, University of Newcastle upon Tyne, UK.  (091) 222 8789

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: [email-masked] (Paul M. Aoki)
Date: Thu, 01 Sep 94 08:53:00 -0700

> 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
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776