agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@cs.berkeley.edu>
To: David Alan Nelson <D.A.Nelson@newcastle.ac.uk>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Time Queries
Date: Thu, 01 Sep 94 08:53:00 -0700
Message-ID: <199409011553.IAA04507@faerie.CS.Berkeley.EDU> (raw)
In-Reply-To: <AA18254.9409011303@swinhoe.ncl.ac.uk>

"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.
==============================================================================



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: aoki@cs.berkeley.edu, D.A.Nelson@newcastle.ac.uk
  Subject: Re: Time Queries
  In-Reply-To: <199409011553.IAA04507@faerie.CS.Berkeley.EDU>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox