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

From Anthony E . Greene
Subject Re: Pg.pm oddity with apostrophes
Date
Msg-id 20000826203353.C4094@cp5340
Whole thread Raw
In response to Pg.pm oddity with apostrophes  (Charles Curley <ccurley@trib.com>)
Responses Re: Pg.pm oddity with apostrophes
List pgsql-novice
On 26 Aug 2000 12:42 Charles Curley wrote:
>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.

Perl will escape the apostrophe and will not pass the backslash on to the
backend. You will need to use a double backslash:

$sql = "INSERT INTO contacts VALUES ('Mr.','Patrick','O\\'Neil','http://URL')";


Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Linux. The choice of a GNU Generation. <http://www.linux.org/>

pgsql-novice by date:

Previous
From: Neil Conway
Date:
Subject: Re: Host problem
Next
From: Charles Curley
Date:
Subject: Re: Pg.pm oddity with apostrophes