Skip site navigation (1) Skip section navigation (2)

Trouble Escaping Quotes

From: "Haron, Charles" <charles(dot)haron(at)cognitive(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Trouble Escaping Quotes
Date: 2005-01-20 21:13:26
Message-ID: 593E515C9586D511BB4500010283D5E202564942@COG-MAIL (view raw, whole thread or download thread mbox)
Lists: pgsql-admin

I'm using a perl function in my PosgreSQL database to send an email.
However, field data containing single quotes causes the function to fail.
I'm having trouble escaping the quotes.  Sample function definition follows.

If company_name is Bob's Fixit, the function will fail.

CREATE OR REPLACE FUNCTION public.send_rma(rma_info)
    use Mail::Sender;
    my ($rma_data) = @_;
    my ($sender) = new Mail::Sender {
      smtp => \'\',
      from => \'supp(at)cog(dot)com\',
     on_errors => \'die\'

      to => \'pgsql-admin(at)postgresql(dot)org\',
      cc => \'supp(at)cog(dot)com\',
      subject => "RMA Request $rma_data->{\'rma\'}"


    $sender->SendLineEnc("[CASE NUMBER]");

    $sender->SendLineEnc("[COMPANY NAME]");


  LANGUAGE 'plperlu' STABLE;



Confidentiality notice:  This electronic transmission message is intended only for the use of the individual or entity to whom it is addressed.  This information should be treated as proprietary, confidential, legally privileged and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient, (or the employee or agent responsible for delivering the message to the intended recipient), you are hereby notified that any use, dissemination, distribution, or copying of this message is strictly prohibited.  If you have received this communication in error, please immediately notify us by telephone (720) 221-9421 or by return e-mail and delete this message.  Thank you for your cooperation.


pgsql-admin by date

Next:From: Joshua D. DrakeDate: 2005-01-20 22:11:48
Subject: Re: Trouble Escaping Quotes
Previous:From: Kris DeugauDate: 2005-01-20 19:01:23
Subject: Re: installing postgres7.3

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group