Subject: append

From: [email-masked] (Praveen Mamnani)
Date: Wed, 21 Sep 1994 01:01:08 -0600

I tried to execute append using libpq PQexec command :
 
it does work if I use integer as an attribute to my class. 
 
The problem arises when I try to use character string , as follows :
 
PQexec("create Info (name=char16, login=char16, age=int4)");     
    PQexec("append Info (name=""david"", login=""dwill"", age=20)");  
 
I have to put the double quotes around the name and login otherwise
I get a syntax error.
 
When I try to run the following in a Program, at execution I get 
the error :
           
type id lookup of 362 failed.
 
I get this similar error, when using frontend monitor (not libpq) when
I do not put any "" around the name and the login as follows :
 
Query sent to backend is "append info(name=joe, login=d, age=2)"
WARN:Sep 21 00:54:12:type id lookup of 362 failed
 
But this does work if I put quotes around joe and d.
 
I am not able to figure out what I am doing wrong syntactically
when using libpq (as shown above).
 
anyones help would be appreciated. 
 
Thank You.
 
Praveen.

==============================================================================
   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: Wed, 21 Sep 94 00:49:56 -0700

> I have to put the double quotes around the name and login otherwise

the way to escape the double-quote character in C is to use a backslash:
	PQexec("append Info (name=\"david\", login=\"dwill\", age=20)");

try this:

faerie:aoki (149)> cat foo.c
main()
{
  printf("%s\n", "this""is""my""string");
  printf("%s\n", "this\"is\"my\"string");
}
faerie:aoki (150)> cc foo.c
faerie:aoki (151)> a.out
thisismystring
this"is"my"string
faerie:aoki (152)> 
--
  Paul M. Aoki          |  University of California at Berkeley
  [email-masked]  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776