problems creating functions and triggers

From: Werner Fraga <werner(dot)fraga(at)computalog(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: problems creating functions and triggers
Date: 2000-01-10 22:32:19
Message-ID: 00011015363303.07948@shorty.edmonton.computalog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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...)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-01-11 00:40:16 Re: [SQL] problems creating functions and triggers
Previous Message Albert Loo 2000-01-10 21:15:39 query to do a backward 'skip', possible with (index) optimization ?