Re: Triggers with DO functionality

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Triggers with DO functionality
Дата
Msg-id 20140916125818.GI25887@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: Triggers with DO functionality  (Thom Brown <thom@linux.com>)
Список pgsql-hackers
On 2014-09-16 13:54:49 +0100, Thom Brown wrote:
> On 16 September 2014 13:45, Andres Freund <andres@2ndquadrant.com> wrote:
> > On 2014-09-16 13:42:22 +0100, Thom Brown wrote:
> > > > > The function can't be the target of CREATE OR REPLACE FUNCTION.
> > > >
> > > > That *really* sucks. To the point of making the feature useless in my
> > > > eyes. That's really something frequently done.
> > > >
> > >
> > > Why not CREATE OR REPLACE TRIGGER?  Wouldn't the function itself be an
> > > internal matter rather than something for users to worry about?  If the
> > > user needs to adjust it, they'd need to discover the name of the function
> > > the trigger referred to, which may not be trivial.
> >
> > Because CREATE OR REPLACE trigger has to take a heavy relation level
> > lock?  Because we don't have it? Because it'll allow to change things
> > that you really don't want to change?
> 
> 
> Would CREATE OR REPLACE trigger need a heavy relational level lock if just
> the anonymous function body were changing?

I think it's unlikely to change. At the very, very least it'd require a
ShareUpdateExclusive lock on the relation.

> My concern is mainly about us on one hand saying "Look, we've removed the
> need for trigger statements when creating triggers", then on the other
> saying "But if you want to change anything, treat it as if we hadn't done
> that, and you'll need to go find the function that we made in the
> background."

So what? The reason for changing stuff is that it requires superfluous
and annoying typing, right? That's much less the case when you just want
to replace the function's contents after the fact.

> I guess if we were to do that, we would just need to make it clear that
> this is all syntactic sugar, and things like \d+ <table> output would show
> the trigger calling the "anonymous" function rather than showing the body
> of the function as part of the trigger.

I think that should be the case anyway.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: Triggers with DO functionality
Следующее
От: Robert Haas
Дата:
Сообщение: Re: jsonb format is pessimal for toast compression