Re: BUG #13513: Turning a table into a view - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #13513: Turning a table into a view
Date
Msg-id 20150722134418.GG19573@alap3.anarazel.de
Whole thread Raw
In response to Re: BUG #13513: Turning a table into a view  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 2015-07-22 09:42:15 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > You can probably work around the problem by inserting a VACUUM
> > tbl_becoming_view; before the CREATE RULE. IIRC that should "recompute"
> > relhastriggers.
>
> Dunno, I think vacuum does update relhasindexes, but there would be no
> reason for it to think about relhastriggers.

I still didn't test, but there appears to be code for relhastriggers:

void
vac_update_relstats(Relation relation,
                    BlockNumber num_pages, double num_tuples,
                    BlockNumber num_all_visible_pages,
                    bool hasindex, TransactionId frozenxid,
                    MultiXactId minmulti,
                    bool in_outer_xact)
{
...
        if (pgcform->relhastriggers && relation->trigdesc == NULL)
        {
            pgcform->relhastriggers = false;
            dirty = true;
        }


Andres

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #13513: Turning a table into a view
Next
From: Jeevan Chalke
Date:
Subject: Gsets: ROW expression semantic broken between 9.4 and 9.5