Re: Rule recompilation

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Rule recompilation
Дата
Msg-id 200107121910.f6CJAJu05171@jupiter.us.greatbridge.com
обсуждение исходный текст
Ответ на Rule recompilation  (Jan Wieck <JanWieck@Yahoo.com>)
Список pgsql-hackers
Tom Lane wrote:
> Jan Wieck <JanWieck@Yahoo.com> writes:
> >     There is of course a difference between the original
> >     CREATE  RULE/VIEW  statement and the string stored here. This
> >     is because we cannot rely on the actual query buffer but have
> >     to parseback the parsetree like done by the utility functions
> >     used for pg_rules.
>
> Did you see my comments about extending the parser to make it possible
> to extract the appropriate part of the query buffer?  This would allow
> us to get rid of the reverse-lister (ruleutils.c) entirely, not to
> mention readfuncs.c (but we'd still want outfuncs.c for debugging, I
> suppose).
   Missed that, but sounds good!

>
> >     Anyway,  what's  the preferred syntax for triggering the rule
> >     recompilation?  I thought about
> >         ALTER RULE {rulename|ALL} RECOMPILE;
> >     Where ALL triggers only those rules where the  user  actually
> >     has RULE access right on a relation.
>
> The proposed definition of ALL seems completely off-base.  If I have
> changed my table foo, which is referenced by a rule attached to
> Joe's table bar, I would like to be able to force recompilation of
> Joe's rule.  If I can't do that, a RECOMPILE command is useless.
> I might as well just restart my backend.
>
> BTW, a RECOMPILE command that affects only the current backend is pretty
> useless anyway.  How are you going to propagate the recompile request to
> other backends?
   Create   a   user   table   (for   testing)   and   save  the   pg_get_ruledef() output of all rules into there.
Thenwrite a   little  PL/pgSQL  function that loops over that table and for   each row does
 
       EXECUTE ''drop rule '' || ...       EXECUTE row.ruledef;
   Break a view by dropping and recreating an underlying  table.   Then  see  what  happens  when  executing the stored
proc...   including what happens in the relcache and other backends.
 
   This isn't  local  recompilation  in  current  backend.  It's   recreation  of the pg_rewrite entry for a relation,
including  propagation.
 


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Rule recompilation
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Re: [GENERAL] Vacuum and Transactions