BUG #18742: /src/backend/rewrite/rewriteHandler.c
BUG #18742: /src/backend/rewrite/rewriteHandler.c
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website: Bug reference: 18742 Logged by: Daniel Elishakov Email address: dan-eli@mail.ru PostgreSQL version: 16.4 Operating system: ubuntu 20.04 Description: 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.
Re: BUG #18742: /src/backend/rewrite/rewriteHandler.c
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
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