Subject: Appending to tinterval type in 4.1

From: [email-masked] (vivek Shipuri)
Date: Mon, 20 Dec 1993 11:37:05 -0500 (EST)

I create a class as follows :-

 create tt(a=tinterval)

 How do I append an time interval to it?
 Whatever is in the manual does not work......and I have tried virtually
 all different combinations I can think of. 

 So let me know if this is a known bug in Postgres and that I should not
 bother with it or if you know how to append to such a relation, I would
 appreciate a reply.

 Thanks

 Vivek
 [email-masked]

---

From: Jolly Chen <[email-masked]>
Date: Mon, 20 Dec 93 15:23:44 -0800

>  bother with it or if you know how to append to such a relation, I would

The manual is incorrect.  (I don't think anybody in the postgres group
has looked at tinterval's for a while)  

The actual syntax for tinterval is 

[ '<abstime>' '<abstime>' ]

Note the square brackets, single quotes and the lack of commas.
<abstime> is any legal abstime specification.   Also, ignore what the
manual says about using pairs of double-quotes to designate least or
greatest time available. Use 'infinity' or '-infinity' instead. 

Below are some examples of how to use tinterval:

* create TINTERVAL_TBL(f1 = tinterval)
\g

Query sent to backend is "create TINTERVAL_TBL(f1 = tinterval) "
CREATE
Go 
* append TINTERVAL_TBL(f1 = "['-infinity' 'infinity']")
append TINTERVAL_TBL(f1 = "['May 10, 1943 23:59:12' 'Jan 14, 1973 03:14:21']")
append TINTERVAL_TBL(f1 = "['epoch' 'now']")
append TINTERVAL_TBL(f1 = "['Feb 15 1990 12:15:03' 'current']")
\g

Query sent to backend is "append TINTERVAL_TBL(f1 = "['-infinity' 'infinity']") append TINTERVAL_TBL(f1 = "['May 10, 1943 23:59:12' 'Jan 14, 1973 03:14:21']") append TINTERVAL_TBL(f1 = "['epoch' 'now']") append TINTERVAL_TBL(f1 = "['Feb 15 1990 12:15:03' 'current']")  "
APPEND 579572APPEND 579573APPEND 579574APPEND 579575
Go 
* retrieve (TINTERVAL_TBL.all)
\g

Query sent to backend is "retrieve (TINTERVAL_TBL.all) "
---------------
| f1          |
---------------
| ['-infinity' 'infinity']|
---------------
| ['Mon May 10 23:59:12 1943 PDT' 'Sun Jan 14 03:14:21 1973 PDT']|
---------------
| ['epoch' 'Mon Dec 20 15:16:24 1993 PDT']|
---------------
| ['Thurs Feb 15 12:15:03 1990 PDT' 'current']|
---------------

Go 
* 

- Jolly Chen