Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA01302; Wed, 8 Jan 92 17:45:41 -0800
Message-Id: <9201090145.AA01302@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: Quotes in Strings
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Reply-To: mer@postgres.berkeley.edu
In-Reply-To: Your message of "Wed, 08 Jan 92 14:23:44 PST."
             <9201082223.AA14132@postgres.Berkeley.EDU> 
Date: Wed, 08 Jan 92 17:45:30 PST

you write:
> 
> I am trying to insert a string into a table, however the  string
> itself has quotes in it, so understandably when I try to apend a
> string from the monitor I get an error : 
> 
> append ProcessSteps ( Station = "Sta1", Entity = "Product", StepNumber = 0.50
 +0
> , Operand = "'FASSIGN("*;ExpectedOpTime",FVAL("OPERATION:OprName=Op1;%%sTime"
 +,CV
> AL("*;Entity")));' " )
> 
> WARN:Jan  8 16:41:03:parser: syntax error at or near ";"
> 
> Does anyone have any ideas how I can overcome this problem ?

The general mechanism for embedding quotes in string constants is to
use the \ character.  The only catch is that when you're running the
terminal monitor you need to give two backslashes:

	create foo ( a = text )
	append foo ( a = "This has a quote \\" <-----" ) \g

so it doesn't try to interpret the double quote as some escape sequence
command (e.g. \g).

	* retrieve (foo.all) \g

	Query sent to backend is "retrieve (foo.all) "
	---------------
	| a           |
	---------------
	| This has a quote " <---|
	---------------


Jeff Meredith
mer@postgres.berkeley.edu
