X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C2F183A54E9 for ; Mon, 24 Jan 2005 16:35:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57075-09 for ; Mon, 24 Jan 2005 16:35:06 +0000 (GMT) Received: from imss.cognitive.com (unknown [64.78.232.56]) by svr1.postgresql.org (Postfix) with ESMTP id 3C7ED3A5534 for ; Mon, 24 Jan 2005 16:35:04 +0000 (GMT) Received: from imss.cognitive.com (localhost [127.0.0.1]) by localhost.cognitive.com (Postfix) with ESMTP id 1649D1B8FD; Mon, 24 Jan 2005 09:37:06 -0700 (MST) Received: from cog-mail.csi (unknown [10.3.0.18]) by imss.cognitive.com (Postfix) with ESMTP id EDC411AC27; Mon, 24 Jan 2005 09:37:05 -0700 (MST) Received: by COG-MAIL with Internet Mail Service (5.5.2653.19) id ; Mon, 24 Jan 2005 09:35:01 -0700 Message-ID: <593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL> From: "Haron, Charles" To: pgsql-admin@postgresql.org Cc: Richard Poole Subject: Re: Trouble Escaping Quotes Date: Mon, 24 Jan 2005 09:34:55 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/245 X-Sequence-Number: 16104 Below is logging information from a client-side SQL monitor, as well as what I found in /data/serverlog: I this particular instance the offending quote is in the problem_desc field. The value of problem_desc being "Bob's Problem" (double quotes excluded). *** Client-Side SQL monitor data *** SET TRANSACTION ISOLATION LEVEL READ COMMITTED;SET DATESTYLE TO ISO;BEGIN; insert into "rmas" ("id", "company_id", "repair_types_id", "printer_models_id", "serial_number", "problem_desc") values (1240916, 126, 3, 595, '45845384568', 'Bob''s Problem') Command executed sucessfully 1 row(s) affected Commiting transaction END; SELECT send_rma(rma_info) FROM rma_info WHERE rma = 1240916 server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. *** Information From /data/serverlog *** server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: WARNING: Message from PostgreSQL backend: The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory. I have rolled back the current transaction and am going to terminate your database system connection and exit. Please reconnect to the database system and repeat your query. Failed. > -----Original Message----- > From: Richard Poole [mailto:rp@guests.deus.net] > Sent: Sunday, January 23, 2005 11:59 AM > To: pgsql-admin@postgresql.org > Cc: Haron, Charles > Subject: Re: Trouble Escaping Quotes > > On Fri, Jan 21, 2005 at 08:43:00AM -0700, Haron, Charles wrote: > > Yes, but how do you escape the quote when the value of the string > > isn't know until the function is run? > > > > If $rma_data->{\'company_name\'} is returning Bob's Fixit > at run time, > > how do escape the quote BEFORE Perl interprets the string and > > generates an error? > > Your quote-escaping looks fine to me; \' is just as good as > '', although less standard. I can't reproduce your problem > here; your function works for me under 8.0.0 and perl 5.8.6 . > What's your error message when you call it? Are you sure that > your problem isn't happening earlier, when you put the data > into the database in the first place? > > > Richard >