pl/pgsql noob

Поиск
Список
Период
Сортировка
Искать

pl/pgsql noob

От:
Don Patou <pknoob@noos.fr>
Дата:
I wanna use a function as a column default value. the problem is that I don't 
know how to use a function as a default value (how to call it) and that my 
function ain't working properly. so here is my function:

CREATE FUNCTION myfunction() RETURNS trigger AS '
    BEGIN
select count(episode.show_name) from episode where 
episode.show_name=show.show_name;
return countshow; 
end;
' LANGUAGE plpgsql;

this function is a query that counts how many show_name are in the table 
episode, show_name is a foreign key from table show. the result is suppose to 
go in the column count_show in table show.

thanx in advance
FAQ