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 15294D1B26B for ; Fri, 14 May 2004 11:45:10 -0300 (ADT) 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 23445-06 for ; Fri, 14 May 2004 11:44:49 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id BD93FD1B208 for ; Fri, 14 May 2004 11:44:42 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Fri May 14 16:44:40 2004 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id QAA28549; Fri, 14 May 2004 16:44:40 +0200 (METDST) From: Christoph Haller Message-Id: <200405141444.QAA20955@rodos> Subject: Re: where is this problem (trigger) To: tedpet5@yahoo.com (Theodore Petrosky) Date: Fri, 14 May 2004 16:44:39 METDST Cc: pgsql-sql@postgresql.org In-Reply-To: <20040512175750.12624.qmail@web41006.mail.yahoo.com>; from "Theodore Petrosky" at May 12, 104 8:16 pm X-Mailer: Elm [revision: 212.4] X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Received' Received: \234by rodos.fzk.de... ^ X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/132 X-Sequence-Number: 17846 > > I fire this trigger whenever my client updates a row > in the db: > > CREATE FUNCTION notify_jobinfo() RETURNS "trigger" > AS ' > BEGIN > EXECUTE ''NOTIFY ''||TG_RELNAME||''_''||NEW.jobnumber; > RETURN NEW; > END > ' > LANGUAGE plpgsql; > > CREATE TRIGGER notify_jobinfo > AFTER UPDATE ON jobinfo > FOR EACH ROW > EXECUTE PROCEDURE notify_jobinfo(); > > > CREATE TABLE jobinfo ( > acode text, > jobnumber text DEFAULT > nextval('public.jobinfo_seq'::text), > creationdate date DEFAULT now(), > shortdescription text, > projectcode text, > holdnumber text, > insertioninfo text, > jobtitle text, > insertiondate text, > iscomplete boolean DEFAULT false, > isbilled boolean DEFAULT false, > CONSTRAINT "$1" CHECK ((jobnumber <> ''::text)) > ); > > My problem is that I have had to import legacy data > for the jobnumber column. My client was originally > using an excel file. they were free to do as they > pleased and there are jobnumbers like '1041.01' > '1041.02'. > > I can not seem to update these rows because of the dot > in the jobnumber field. I have found that I can change > the dot to an underscore but I thought I would ask if > there is a better solution. > > here is the error: > > UPDATE jobinfo SET isbilled = false WHERE jobnumber = > '1162.01'; > ERROR: syntax error at or near ".01" at character 20 > CONTEXT: PL/pgSQL function "notify_jobinfo" line 2 at > execute statement > > Ted > > I can hardly believe the dot in '1162.01' is causing the error. There must be some other reason. Without showing the trigger procedure's code it's impossible to tell what's really wrong. Regards, Christoph