Re: Missing dependency tracking for TableFunc nodes

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: Missing dependency tracking for TableFunc nodes
Date: 2019-11-13 23:00:03
Message-ID: 997cbcae-7739-f871-84a0-1192380abb54@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/11/19 1:41 PM, Tom Lane wrote:
> I happened to notice that find_expr_references_walker has not
> been taught anything about TableFunc nodes, which means it will
> miss the type and collation OIDs embedded in such a node.
>
> This can be demonstrated to be a problem by the attached script,
> which will end up with a "cache lookup failed for type NNNNN"
> error because we allow dropping a type the XMLTABLE construct
> references.
>
> This isn't hard to fix, as per the attached patch, but it makes
> me nervous. I wonder what other dependencies we might be missing.

I can consistently generate errors like the following in master:

ERROR: cache lookup failed for statistics object 31041

This happens in a stress test in which multiple processes are making
changes to the schema. So far, all the sessions that report this cache
lookup error do so when performing one of ANALYZE, VACUUM ANALYZE,
UPDATE, DELETE or EXPLAIN ANALYZE on a table that has MCV statistics.
All processes running simultaneously are running the same set of
functions, which create and delete tables, indexes, and statistics
objects, insert, update, and delete rows in those tables, etc.

The fact that the statistics are of the MCV type might not be relevant;
I'm creating those on tables as part of testing Tomas Vondra's MCV
statistics patch, so all the tables have statistics of that kind on them.

I can try to distill my test case a bit, but first I'd like to know if
you are interested. Currently, the patch is over 2.2MB, gzip'd. I'll
only bother distilling it if you don't already know about these cache
lookup failures.

--
Mark Dilger

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-11-14 00:25:46 Re: tuplesort test coverage
Previous Message Li, Zheng 2019-11-13 22:25:56 Re: NOT IN subquery optimization