Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iV1cT-0001vW-R5 for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Nov 2019 23:00:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iV1cS-0008ND-Ci for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Nov 2019 23:00:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iV1cR-0008N6-Tf for pgsql-hackers@lists.postgresql.org; Wed, 13 Nov 2019 23:00:12 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iV1cM-0004DU-Lm for pgsql-hackers@lists.postgresql.org; Wed, 13 Nov 2019 23:00:10 +0000 Received: by mail-pf1-x441.google.com with SMTP id q13so2689837pff.2 for ; Wed, 13 Nov 2019 15:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=izfQzsJH3YrmoATvc93XcojiJ8FmPHrcRXS9jhzc/kA=; b=kcAsob5wsYpogcDsoVQYmumxXVPj0oHY+vn/qFXrl1NJI9pVbOIjEUjRrPflyrHcOB nNmGIM+zAwwnMLMzIBgTk4qu6irYVEvAuhXLLrDcVpXPslV1PwivHpL48Zd1lRgcDyih v6pvWG1dbcDs5ObRhxtBkt1Dg8XfwOegcTHdV2sKl9xZXywZB0JgC4ZYftYU2DUp5Oot 6qujbzRD01fKKibw+BSXntb6Ur2w47/kMp1QIYaTfVjWl/v9W9KF/YRldaq6tmNEh3oo 8i7uDn66ie8LHinhFFZoBZajMXR99FUlb8MmFkgM6vwwQC3b26fBM5SsnwmoPlx8d4N8 eagg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=izfQzsJH3YrmoATvc93XcojiJ8FmPHrcRXS9jhzc/kA=; b=Fkc8S5hUU6G6POkABRvCS5wsd1YWLdjXGUzfsO+CqOl0ggPRoNAuQuS0b2qrwGyF/W SyfZWIMjs1BRjWnLNQc9c+6amkZ+Ej/wd9gYBaANWhFJMgE5i1X+gpDPL9nwE2LlWDi3 uLN6uuy5EEcJk641UfeHdMJxQpvZPRMUyGYQx79alQioovkHJfheDyyhGegRN2l+pIda RNWXVUlE4globcZIMRyTNsl1pMzLz0Tbv6Tpv/2btW9nYeNpUlWq9QrcnpYm384830y+ Ism2PYKJo4ntldbQb8lssj/rR/BVL02v9H03E1TQiX04PMWf+tHCwrWYlMTBrNsw/C2y L8ew== X-Gm-Message-State: APjAAAW3diz5j1zrFl21q/qjg0ioquUWTp1VVLSI8J0CQL7USCBkkKeQ o604SYVdVx41uSpK8i3Elz0= X-Google-Smtp-Source: APXvYqyjZJ1LTxlbXlIuGOvaRhA5kPKRCWq43h/Pglti1MF6BcZ2CedSv7CQ0xKK+p/eIwKgGJY4yQ== X-Received: by 2002:a62:1514:: with SMTP id 20mr7316805pfv.217.1573686005549; Wed, 13 Nov 2019 15:00:05 -0800 (PST) Received: from [192.168.0.17] (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id l13sm509448pjq.18.2019.11.13.15.00.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Nov 2019 15:00:05 -0800 (PST) Subject: Re: Missing dependency tracking for TableFunc nodes To: Tom Lane , pgsql-hackers@lists.postgresql.org, Tomas Vondra References: <18427.1573508501@sss.pgh.pa.us> From: Mark Dilger Message-ID: <997cbcae-7739-f871-84a0-1192380abb54@gmail.com> Date: Wed, 13 Nov 2019 15:00:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <18427.1573508501@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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