From: | Marc Britten <mbritten(at)cybernet-usa(dot)com> |
---|---|
To: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | trigger errors |
Date: | 2000-06-14 18:11:33 |
Message-ID: | ABFF67479EC9D111AFA30060B01AACDA03ADF68B@mail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
hi again,
i created a trigger on a table for insert or delete, and a function that
gets created fine.
however when i go to insert something into the table i get
NOTICE: plpgsql: ERROR during compile of create_count_cache near line 2
ERROR: parse error at or near ";"
definitions follow(this is the exact syntax and order i used to create the
function table and trigger, all other tables in referenced do exist and have
ALL permissions turned on for the user)
CREATE FUNCTION create_count_cache()
RETURNS opaque AS
'
BEGIN;
DELETE FROM LangCount;
INSERT INTO LangCount SELECT LangID as ID, COUNT(LangID) AS CNT
FROM snippet GROUP BY LangID;
DELETE FROM CatCount;
INSERT INTO CatCount SELECT LangID as ID, COUNT(LangID) AS CNT FROM
snippet GROUP BY LangID;
COMMIT;
'
LANGUAGE 'plpgsql';
CREATE TABLE snippet (
UserName VARCHAR(12),
LangID INT,
CatID INT DEFAULT 0,
name VARCHAR(30),
snippet TEXT);
grant ALL ON snippet to codelibrary;
CREATE INDEX front_select ON snippet (UserName, LangID, name);
CREATE INDEX cat_select ON snippet (UserName, CatID, name);
CREATE TRIGGER count_change
AFTER DELETE OR INSERT ON snippet FOR EACH ROW
EXECUTE PROCEDURE create_count_cache();
i then call
insert into snippet (UserName, LangID, name, snippet)
values ('mbritten', 1, 'my snippet', 'int i = 0;');
and get the error.
thanks for your time,
marc britten
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew | 2000-06-14 19:05:07 | RE: Crosstab SQL Question |
Previous Message | Ron Peterson | 2000-06-14 17:15:46 | Re: Crosstab SQL Question |