From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jan Wieck <JanWieck(at)Yahoo(dot)com>, PostgreSQL HACKERS <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Rule recompilation |
Date: | 2001-07-12 19:10:19 |
Message-ID: | 200107121910.f6CJAJu05171@jupiter.us.greatbridge.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Jan Wieck <JanWieck(at)Yahoo(dot)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. Then write 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(at)Yahoo(dot)com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-07-12 19:11:00 | Re: Rule recompilation |
Previous Message | Tom Lane | 2001-07-12 19:04:02 | Re: Re: Strangeness in xid allocation / snapshot setup |