X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AAA06528DA for ; Fri, 22 Jul 2005 16:17:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79848-06 for ; Fri, 22 Jul 2005 19:17:44 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id 0AD095291A for ; Fri, 22 Jul 2005 16:17:41 -0300 (ADT) Received: from [10.10.1.151] (BRICK [10.10.1.151]) by presinet-main.presinet.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2658.3) id 3HW09XA6; Fri, 22 Jul 2005 12:13:08 -0700 Message-ID: <42E14655.4090106@PresiNET.com> Date: Fri, 22 Jul 2005 12:17:41 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Hofmann Cc: pgsql-sql@postgresql.org Subject: Re: Tigger References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/198 X-Sequence-Number: 22176 David Hofmann wrote: > I've look throught the docs and from what I can see the bellow code > should work, however I keep getting the error: > > ERROR: parser: parse error at or near "$" at character 53 > > CREATE FUNCTION session_update() RETURNS trigger AS $session_update$ > BEGIN > -- Check date exists > IF NEW.stamp_lastupdate IS NULL THEN > NEW.stamp_lastupdate := 'now'; > END IF; > RETURN NEW; > END; > > $session_update$ LANGUAGE plpgsql; > > CREATE TRIGGER session_update BEFORE INSERT OR UPDATE ON sessions FOR > EACH ROW EXECUTE PROCEDURE session_update(); > > > Any help or suggestions of websites I should read would be appercated. > > David Which version of postgresql are you using? I don't believe that the "$" quoting was available in older versions than 8 (or late 7?). -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________