Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id BAA12713 for postgres-dist; Fri, 12 Nov 1993 01:34:50 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199311120934.BAA12713@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.149.14]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id BAA12704 for <postgres@nobozo.CS.Berkeley.EDU>; Fri, 12 Nov 1993 01:34:49 -0800
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.3/8.1B) with SMTP id BAA04071; Fri, 12 Nov 1993 01:34:46 -0800
Message-Id: <199311120934.BAA04071@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
To: John Peter Lee <jlee@cs.uml.edu>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: time types 
In-reply-to: Your message of Thu, 11 Nov 1993 13:57:34 -0500 (EST) 
	     <199311111857.AA14014@cs.uml.edu> 
Date: Fri, 12 Nov 93 01:34:46 -0800
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-dist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Fri, 12 Nov 93 01:34:50 -0800
Resent-XMts: smtp

John Peter Lee <jlee@cs.uml.edu> writes:
>    I want to know if when I specify time in libPQ (by building a
>    character buffer), do the times have to be double-quoted, like so:
>     sprintf (buf, "append db_meta_data ( ... 
> 	date_created = %s, \			/* <- abstime type */
> 	...
> 	range = %s \				/* <- tinterval type */
> 	)",
> 	...
> 
> 	"Nov 12 1993",				/8 date_created */

you need actual double-quotes *in the query* here.  so you need
	date_created = \"%s\"
in your sprintf control string.

> 	"[Jan 01 1974, Dec 31 1992]"		/* range */

the tinterval code likes single-quotes around each time.  confusingly,
time range expressions (time travel) use commas, but i don't think
the tinterval ADT code likes commas.  i think 
	range = \"%s\"
	"['Jan 01 1974' 'Dec 31 1992']"
works better.  (at least, it does on our development system.)  this
should probably be made consistent.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki
