| From: | Don Patou <pknoob(at)noos(dot)fr> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | pl/pgsql noob |
| Date: | 2003-06-01 17:12:09 |
| Message-ID: | 200306011912.09344.pknoob@noos.fr |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josh Berkus | 2003-06-01 18:38:46 | Re: Me again..nOOb alert |
| Previous Message | Frank Bax | 2003-06-01 14:22:49 | Re: Me again..nOOb alert |