problems creating functions and triggers

Поиск
Список
Период
Сортировка
От Werner Fraga
Тема problems creating functions and triggers
Дата
Msg-id 00011015363303.07948@shorty.edmonton.computalog.com
обсуждение исходный текст
Ответы Re: [SQL] problems creating functions and triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
I am having problems creating functions and triggers in Postgres 6.5.3
on Linux Mandrake 6.1.

1. I noticed that some examples show the LANGUAGE in the CREATE FUNCTION
command can be 'plpgsql'. However, if I try using this instead of 'sql', I get
ERROR: Unrecognized language specified in a CREATE FUNCTION ...
However, I read somewhere that triggers don't work with LANGUAGE 'sql'.

Am I missing some part of Postgres installation?

2. If I create a function successfully (with LANGUAGE 'sql', then try to
create a trigger using this function, I get

create function checkStationID (int4) returns int4 as
'select Station.StationID from Station where Station.StationID = $1;'
language 'SQL';
CREATE

create trigger ifStationExists BEFORE INSERT OR UPDATE ON Employee FOR EACH ROW EXECUTE PROCEDURE checkStationID
(stationID);
ERROR:  CreateTrigger: function checkstationid() does not exist

Is this because LANGUAGE should be 'plpgsql'? The function does exist; I can
run it using 'Select checkStationID (5)'.

3. Is there anywhere I can find a list of the system tables? (that section in
Bruce's book is still empty...)


В списке pgsql-sql по дате отправления:

Предыдущее
От: Werner Fraga
Дата:
Сообщение: problems creating functions, triggers, and rules
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] problems creating functions and triggers