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 0519856729 for ; Tue, 15 Mar 2005 02:41:37 +0000 (GMT) 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 50474-05 for ; Tue, 15 Mar 2005 02:41:26 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id D029256737 for ; Tue, 15 Mar 2005 02:41:21 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j2F2f5qi020049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Mar 2005 19:41:09 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j2F2f5eC059813; Mon, 14 Mar 2005 19:41:05 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j2F2f43W059812; Mon, 14 Mar 2005 19:41:04 -0700 (MST) (envelope-from mfuhr) Date: Mon, 14 Mar 2005 19:41:04 -0700 From: Michael Fuhr To: Timothy Smith Cc: pgsql-sql@postgresql.org Subject: Re: postgresql 8.01, plpgsql Message-ID: <20050315024104.GA59736@winnie.fuhr.org> References: <42363BD1.6090405@open-networks.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42363BD1.6090405@open-networks.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.318 tagged_above=0 required=5 tests=AWL, URIBL_SBL X-Spam-Level: X-Archive-Number: 200503/204 X-Sequence-Number: 20683 On Tue, Mar 15, 2005 at 11:35:13AM +1000, Timothy Smith wrote: > i have the following function in plpgsql giving stynax errors all over > the place. When I load the function you posted I get this: test=> \i foo.sql psql:foo.sql:87: ERROR: syntax error at or near "END" at character 2851 psql:foo.sql:87: LINE 83: END; psql:foo.sql:87: ^ If I add a semicolon to the NULL statement in the exception handler then it loads successfully. > one thing to note is i followed this example > http://www.zigo.dhs.org/postgresql/#insert_or_update and it gives the > same errors. I get no errors loading the example in the "Insert or Update" section of that page. > "ERROR: unterminated dollar-quoted string at or near "$$ > BEGIN > LOOP" This looks like the parser is reaching EOF before the end of the function body. How are you loading the function? I usually store code in a file and use "psql -f filename" from the shell or "\i filename" from the psql prompt. If you're not already doing that, what happens when you try it? -- Michael Fuhr http://www.fuhr.org/~mfuhr/