create function error

Поиск
Список
Период
Сортировка
От Tony Crisera
Тема create function error
Дата
Msg-id 46A8E654.9080402@ptd.net
обсуждение исходный текст
Ответы Re: create function error  (Michael Glaesemann <grzm@seespotcode.net>)
Список 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 по дате отправления:

Предыдущее
От: JohnSense
Дата:
Сообщение: tsearch2 problems in postgres?
Следующее
От: "Bodó István"
Дата:
Сообщение: PostgreSQL install problem