create function error

From: Tony Crisera <tcrisera(at)ptd(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: create function error
Date: 2007-07-26 18:22:12
Message-ID: 46A8E654.9080402@ptd.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We have gotten these errors every time we try to create a function
through psql. However, if we run the same statements using phpPgAdmin
or pgAdmin III query tool it works fine.
Here's the error-
ERROR: unterminated dollar-quoted string at or near "$$
BEGIN
NEW.mod_date := now();" at character 63
ERROR: syntax error at or near "RETURN" at character 9
WARNING: there is no transaction in progress
ERROR: unterminated dollar-quoted string at or near "$$
LANGUAGE plpgsql;" at character 1
ERROR: function public.setproposalmoddate() does not exist

Here is a script that produces the error-
CREATE OR REPLACE FUNCTION setproposalmoddate() RETURNS TRIGGER AS
$mod_date$
BEGIN
NEW.mod_date := now();
RETURN NEW;
END;
$mod_date$ LANGUAGE plpgsql;

CREATE TRIGGER dcproposalmodified BEFORE UPDATE
ON dcproposal FOR EACH ROW
EXECUTE PROCEDURE setproposalmoddate();

What's more, if we use pgAdmin III to create the function, if we do an
export and then try to import into another db with psql, we get the same
error.
select version() returns PostgreSQL 8.1.4 on i686-pc-linux-gnu, compiled
by GCC gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

Thanks,

--
Tony Crisera

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-07-26 20:15:22 Re: The database slows down after a few weeks
Previous Message Jeff Davis 2007-07-26 18:06:11 Re: Porting MySQL data types to PostgreSQL