RE: trouble with triggers
От | Robert Treat |
---|---|
Тема | RE: trouble with triggers |
Дата | |
Msg-id | AMENJOLMNKAEOIGHHILBAELLCBAA.robertt@auctionsolutions.com обсуждение исходный текст |
Ответ на | Re: trouble with triggers (Fran Fabrizio <ffabrizio@mmrd.com>) |
Ответы |
RE: trouble with triggers
|
Список | pgsql-general |
> > > > CREATE TRIGGER formatname BEFORE update OR insert ON mytable > FOR EACH row > > EXECUTE PROCEDURE lower(name); > > The way I understand it, you can't just use any function as a > trigger. It has > to have a return type of opaque. I see that you are basically trying to > convert to lowercase before inserting, but I'm pretty sure you'd > have to define > your own pgplsql function for the trigger which uses the special > variable 'new' > to access the incoming row. Your function can call lower() of course. > > Others here can probably give you more details. > > -Fran Does the function have to be written using the plpgsql language? I tried writing my own function using just sql and it gave the same error message. I did trying writing the function using pgplsql: CREATE FUNCTION formatmyname() RETURNS opaque AS ' BEGIN new.name := lower(new.name); RETURN NEW; END; ' LANGAUGE 'pgplsql'; but got back a message that pgplsql was an unrecognized langauge, so I'm looking for a non pgplsql solution. If I'm spinning my wheels I will work on getting pgplsql working, but I'm hopeing to do it with a simpler approach. robert
В списке pgsql-general по дате отправления: