Re: Pg.pm oddity with apostrophes - Mailing list pgsql-novice

From Charles Curley
Subject Re: Pg.pm oddity with apostrophes
Date
Msg-id 20000826194529.C28579@trib.com
Whole thread Raw
In response to Re: Pg.pm oddity with apostrophes  (David Cantrell <david@cantrell.org.uk>)
List pgsql-novice
On Sat, Aug 26, 2000 at 07:43:56PM +0100, David Cantrell wrote:
> On Sat, Aug 26, 2000 at 10:42:11AM -0600, Charles Curley wrote:
>
> > I am using pg.pm with perl ...
> >
> > The oddity I have hit is that if I try to inset a name with an apostrophe
> > in it (e.g. O'Neil), pgsql belly-aches and returns an error of 7. The
> > record is not inserted. If I remove the apostrophe, the otherwise identical
> > record goes in just fine. I am escaping the apostrophe correctly, as far
> > as I know. The insert query is as follows:
> >
> > Insert into contacts VALUES ( 'Mr.', 'Patrick', 'O\'Neil', blah, blah... 'http://URL' ); "
> >
> > I can insert the name from psql with no problems, which makes me think it
> > is a Pg.pm problem.
>
> Looks more like it's a problem with your understanding of perl.  Can you
> post the exact perl code you're using to execute that query?

Your request prompted me to look over the code to extract it for this
message. That lead me to look at how I was doing not only the insertion
but also the query to send back the inserted record to the user for
approval. In the process of doing that I realized: I was inserting an
escaped apostrophe, but making the select on an unescaped apostrophe. The
fix became immediately apparent.

My previous two message require revision: a proper way to escape an
apostrophe is with a slash. I have not tried doubling it.

Thanks.

--

        -- C^2

No windows were crashed in the making of this email.

Looking for fine software and/or web pages?
http://w3.trib.com/~ccurley
Attachment

pgsql-novice by date:

Previous
From: Charles Curley
Date:
Subject: Re: Pg.pm oddity with apostrophes
Next
From: Assefa Yewondwossen
Date:
Subject: Postgres on NT