pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Haron, Charles <charles.haron@cognitive.com>
To: pgsql-admin@postgresql.org
Cc: Richard Poole <rp@guests.deus.net>
Subject: Re: Trouble Escaping Quotes
Date: Mon, 24 Jan 2005 09:34:55 -0700
Message-ID: <593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL> (raw)

Below is logging information from a client-side SQL monitor, as well as what
I found in <posgresqlhome>/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 <posgresqlhome>/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
> 



view thread (9+ messages)  latest in thread

Message-ID: <593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL>
Permalink:  ../593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL/
Also on:    postgresql.org/message-id/593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: charles.haron@cognitive.com, rp@guests.deus.net
  Subject: Re: Trouble Escaping Quotes
  In-Reply-To: <593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL>
  References: <593E515C9586D511BB4500010283D5E202564AC4@COG-MAIL>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox