pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: stephen@cass-ltd.co.uk
To: pgsql-sql@postgresql.org
Subject: Re: Select and functions
Date: Wed, 5 Nov 2003 11:54:24 -0800 (PST)
Message-ID: <20031105195424.7444.qmail@web20803.mail.yahoo.com> (raw)
In-Reply-To: <200311051426.19315.stephen@cass-ltd.co.uk>

--- "Stephen J. Thompson" <stephen@cass-ltd.co.uk>
wrote:

> But if I use it in a before trigger the procedure
> fails to work. 
> 
> CREATE OR REPLACE FUNCTION
> staging.write_work_country()
>   RETURNS trigger AS
> '
> 	DECLARE
> 		alias_rec RECORD;
> 	BEGIN
> 		-- Clean the phone number
> 		NEW.worktelephonenumber =
> REPLACE(NEW.worktelephonenumber,' ','');
> 		RETURN NEW;
> 	END;
> ' 
> 
> I get the following error:
> 
> ERROR:  parser: parse error at or near "','');
> 
> Can anyone help me please?

Single quotes inside function bodies need to be
escaped.  The easiest way is to double them, i.e. from
one single quote to two single quotes.  Backslashes
would work just as well (and also need to be escaped
if used in a function body).

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



view thread (3+ messages)

Message-ID: <20031105195424.7444.qmail@web20803.mail.yahoo.com>
Permalink:  ../20031105195424.7444.qmail@web20803.mail.yahoo.com/
Also on:    postgresql.org/message-id/20031105195424.7444.qmail@web20803.mail.yahoo.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff_eckermann@yahoo.com, stephen@cass-ltd.co.uk
  Subject: Re: Select and functions
  In-Reply-To: <20031105195424.7444.qmail@web20803.mail.yahoo.com>

* 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