Re: Pg.pm oddity with apostrophes

From: "Anthony E (dot) Greene" <agreene(at)pobox(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Pg.pm oddity with apostrophes
Date: 2000-08-27 00:33:53
Message-ID: 20000826203353.C4094@cp5340
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pobox(dot)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/>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Charles Curley 2000-08-27 01:25:45 Re: Pg.pm oddity with apostrophes
Previous Message Neil Conway 2000-08-26 20:23:10 Re: Host problem