create function error - Mailing list pgsql-general

From Tony Crisera
Subject create function error
Date
Msg-id 46A8E654.9080402@ptd.net
Whole thread Raw
Responses Re: create function error
List 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




pgsql-general by date:

Previous
From: JohnSense
Date:
Subject: tsearch2 problems in postgres?
Next
From: "Bodó István"
Date:
Subject: PostgreSQL install problem