Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tKg2I-00A91V-0u for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Dec 2024 15:51:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tKg2F-009kEU-DD for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Dec 2024 15:51:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tKg2F-009kEK-4a for pgsql-bugs@lists.postgresql.org; Mon, 09 Dec 2024 15:51:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tKg2D-001vHV-Sb for pgsql-bugs@lists.postgresql.org; Mon, 09 Dec 2024 15:50:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4B9FouFY3906518; Mon, 9 Dec 2024 10:50:56 -0500 From: Tom Lane To: dan-eli@mail.ru cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18742: /src/backend/rewrite/rewriteHandler.c In-reply-to: <18742-95fbdd0c522076ad@postgresql.org> References: <18742-95fbdd0c522076ad@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 09 Dec 2024 11:23:51 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3906516.1733759456.1@sss.pgh.pa.us> Date: Mon, 09 Dec 2024 10:50:56 -0500 Message-ID: <3906517.1733759456@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > Deref of view->rd_rules->numLocks takes place without checking > view->rd_rules for NULL. The check rel->rd_rules for NULL above leaves an > opportunity for calling get_view_query() function. During the initialization > and execution rd_rules field of Relation structure is NULL. The preceding "Assert(view->rd_rel->relkind == RELKIND_VIEW)" should provide sufficient assurance that the Relation has an rd_rules entry. If it does not, well, the ensuing core dump would have about the same result as "Assert(view->rd_rules != NULL)". So I feel no need to add any additional checks there. The short answer is that it's caller error if this function is executed on a non-view, and there is no reason to believe that any such bug exists. This sort of microscopic analysis that doesn't take things like that into account isn't terribly useful. (Of course, if you can demonstrate a real case whereby this is reached, that would be interesting.) regards, tom lane