Create Triggers Documentation Error

Поиск
Список
Период
Сортировка
От john huttley
Тема Create Triggers Documentation Error
Дата
Msg-id 000901bfb25d$d36b7200$ca5fa8c0@hisdad.org.nz
обсуждение исходный текст
Список pgsql-general
Quite a few people (including me) have had problems with creating triggers.

Last week Jan gave us the definative answer.

No,

    trigger procedures in Postgres are allways defined to take no
    arguments and have a return type "opaque".

    The main error above is, that the "sql"  language  cannot  be
    used to define a trigger!

    Use  the  PL/pgSQL  or  PL/Tcl  languages  instead.   They're
    documented in the programmers manual.  Version 7.0 will  have
    PL/Perl  too,  but  I  don't know if that one can be used for
    trigger procs yet.


Jan


But look at this snippet from the Docs on 'Create Trigger'

It is definately passing parameters to the trigger procedure.
Something needs to be fixed up here. Preferably in a way that lets us
pass parameters to trigger procedures!!



Usage
Check if the specified distributor code exists in the distributors table
before appending or updating a row in the table films:

CREATE TRIGGER if_dist_exists
    BEFORE INSERT OR UPDATE ON films FOR EACH ROW
    EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');


Before cancelling a distributor or updating its code, remove every reference
to the table films:

CREATE TRIGGER if_film_exists
    BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
    EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films',
'did');










Regards
john




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.0RC1: possible query and backend problem
Следующее
От: Andrew Schmeder
Дата:
Сообщение: what does this error mean?