X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BCCE1D1BB46 for ; Wed, 5 Nov 2003 14:30:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 53531-02 for ; Wed, 5 Nov 2003 10:30:14 -0400 (AST) Received: from tmailb1.svr.pol.co.uk (tmailb1.svr.pol.co.uk [195.92.168.141]) by svr1.postgresql.org (Postfix) with ESMTP id 77677D1BB47 for ; Wed, 5 Nov 2003 10:30:10 -0400 (AST) Received: from modem-3486.lynx.dialup.pol.co.uk ([217.135.205.158] helo=andorian) by tmailb1.svr.pol.co.uk with esmtp (Exim 4.14) id 1AHOeo-0006Pv-Dv for pgsql-sql@postgresql.org; Wed, 05 Nov 2003 14:29:16 +0000 Received: from localhost (andorian [127.0.0.1]) by andorian (Postfix) with ESMTP id 66AF778C2 for ; Wed, 5 Nov 2003 14:30:34 +0000 (GMT) Received: from andorian ([127.0.0.1]) by localhost (andorian [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06084-07 for ; Wed, 5 Nov 2003 14:30:31 +0000 (GMT) Received: from ferengi.cass-ltd.co.uk (ferengi.cass-ltd.co.uk [192.168.104.52]) by andorian (Postfix) with ESMTP id 597F47809 for ; Wed, 5 Nov 2003 14:30:31 +0000 (GMT) From: "Stephen J. Thompson" Reply-To: stephen@cass-ltd.co.uk Organization: Control and Software Solutions Ltd To: pgsql-sql@postgresql.org Subject: Select and functions Date: Wed, 5 Nov 2003 14:26:05 +0000 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200311051426.19315.stephen@cass-ltd.co.uk> X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at cass-ltd.co.uk X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/28 X-Sequence-Number: 15843 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, I am having a little bit of trouble here.=20 If I use the replace function in a select statement all works as expected. select firstname, lastname, replace(worktelephonenumber, ' ', '') AS workte= l=20 from contacts; But if I use it in a before trigger the procedure fails to work.=20 CREATE OR REPLACE FUNCTION staging.write_work_country() RETURNS trigger AS ' DECLARE alias_rec RECORD; BEGIN -- Clean the phone number NEW.worktelephonenumber =3D REPLACE(NEW.worktelephonenumber,' ',''); RETURN NEW; END; '=20 I get the following error: ERROR: parser: parse error at or near "',''); Can anyone help me please? Thanks. Stephen. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/qQiKDAwPLUWQb6sRAhNpAJ0QdVzmYdhAhFVXf06v5zACuS3y9wCfSSlS W18AFuYb4J1le0W32uuIJto=3D =3Dxe/b -----END PGP SIGNATURE-----