Re: pgsql: Add infrastructure to support EphemeralNamedRelation references.

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Kevin Grittner <kgrittn(at)postgresql(dot)org>, "pgsql-committers(at)postgresql(dot)org" <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add infrastructure to support EphemeralNamedRelation references.
Date: 2017-04-06 23:10:46
Message-ID: CACjxUsPxxt+1TvnDMoxMijRLQ1+tMLK+aiD_ODCNa0TOun9ybw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Thu, Apr 6, 2017 at 5:20 PM, Kevin Grittner <kgrittn(at)gmail(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2017-04-06 23:13:17 pgsql: Reset API of clause_selectivity()
Previous Message Kevin Grittner 2017-04-06 22:38:47 pgsql: Fix the RTE_NAMEDTUPLESTORE case in get_rte_attribute_is_dropped