Re: [COMMITTERS] pgsql: Add infrastructure to supportEphemeralNamedRelation references. - Mailing list pgsql-committers

From Kevin Grittner
Subject Re: [COMMITTERS] pgsql: Add infrastructure to supportEphemeralNamedRelation references.
Date
Msg-id CACjxUsPxxt+1TvnDMoxMijRLQ1+tMLK+aiD_ODCNa0TOun9ybw@mail.gmail.com
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Add infrastructure to supportEphemeralNamedRelation references.  (Kevin Grittner <kgrittn@gmail.com>)
Responses Re: [COMMITTERS] pgsql: Add infrastructure to supportEphemeralNamedRelation references.  (Kevin Grittner <kgrittn@gmail.com>)
List pgsql-committers
On Thu, Apr 6, 2017 at 5:20 PM, Kevin Grittner <kgrittn@gmail.com> wrote:

> I'll commit this fix first so I don't hold up Andres or break any
> picky buildfarm critters

Done.

> and then see whether I can't manage to get
> the tests to cover this code.

The function in question is only called from rewrite, and here's the
relevant comment:

 * About JOINs and dropped columns: although the parser never includes an
 * already-dropped column in a JOIN RTE's alias var list, it is possible for
 * such a list in a stored rule to include references to dropped columns.
 * (If the column is not explicitly referenced anywhere else in the query,
 * the dependency mechanism won't consider it used by the rule and so won't
 * prevent the column drop.)  To support get_rte_attribute_is_dropped(), we
 * replace join alias vars that reference dropped columns with null pointers.

So, to test this I guess I need to create a view that does SELECT *
on a table, write a plpgsql trigger function and use it as an AFTER
EACH STATEMENT trigger on that table -- referencing the view and
explicitly using a specific column from the transition table in a
join qual, modify the table so the trigger gets fired and the
function gets cached, ALTER the table to drop the column so
referenced without doing anything that might cause the function plan
to be discarded from cache, and then modify the table again to fire
the cached trigger.  Does that seem like the right test to add?  Or
would even that fail to reach this code because the transition table
is not on the view?

Oh well, I guess I'll write the code and find out -- seems easier
than reverse-engineering that code path.

--
Kevin Grittner


pgsql-committers by date:

Previous
From: Kevin Grittner
Date:
Subject: [COMMITTERS] pgsql: Fix the RTE_NAMEDTUPLESTORE case inget_rte_attribute_is_dropped
Next
From: Simon Riggs
Date:
Subject: [COMMITTERS] pgsql: Reset API of clause_selectivity()