Re: pg_partition_tree crashes for a non-defined relation

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: pg_partition_tree crashes for a non-defined relation
Дата
Msg-id 20181208134608.GY3415@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: pg_partition_tree crashes for a non-defined relation  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: pg_partition_tree crashes for a non-defined relation  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Greetings,

* Michael Paquier (michael@paquier.xyz) wrote:
> On Fri, Dec 07, 2018 at 11:33:32PM -0500, Tom Lane wrote:
> > How about cases where the relation OID exists but it's the wrong
> > kind of relation?
>
> Such cases already return an error:
> =# create sequence popo;
> CREATE SEQUENCE
> =# select pg_partition_tree('popo');
> ERROR:  42809: "popo" is not a table, a foreign table, or an index
> LOCATION:  pg_partition_tree, partitionfuncs.c:54
>
> I think that's a sensible choice, because it makes no sense to look for
> the inheritors of unsupported relkinds.  Perhaps you have a different
> view on the matter?

We should really have a more clearly defined policy around this, but my
recollection is that we often prefer to return NULL rather than throwing
an error for the convenience of people doing things like querying
pg_class using similar functions.

I wonder if we maybe should have a regression test for every such
function which just queries the catalog in a way to force the function
to be called for every relation defined in the regression tests, to
ensure that it doesn't segfault or throw an error..

Thanks!

Stephen

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: COPY FROM WHEN condition
Следующее
От: John Naylor
Дата:
Сообщение: Re: WIP: Avoid creation of the free space map for small tables