Re: Getting fancy errors when accessing information_schema on 10.5

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting fancy errors when accessing information_schema on 10.5
Дата
Msg-id 20191.1540901834@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Getting fancy errors when accessing information_schema on 10.5  (Axel Rau <Axel.Rau@Chaos1.DE>)
Ответы Re: Getting fancy errors when accessing information_schema on 10.5  (Axel Rau <Axel.Rau@Chaos1.DE>)
Re: Getting fancy errors when accessing information_schema on 10.5  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-admin
Axel Rau <Axel.Rau@Chaos1.DE> writes:
>> Am 30.10.2018 um 08:42 schrieb Laurenz Albe <laurenz.albe@cybertec.at>:
>> Could you run EXPLAIN on the query and tell us the execution plan?

> EXPLAIN  SELECT sequence_name AS relname, sequence_schema AS schemaname
> FROM information_schema.sequences
> WHERE sequence_schema NOT LIKE 'pg\_%' AND sequence_schema != 'information_schema';
> ...
>                      ->  Seq Scan on pg_class c  (cost=0.00..28.56 rows=22 width=72)
>                            Filter: ((pg_has_role(relowner, 'USAGE'::text) OR has_sequence_privilege(oid, 'SELECT,
UPDATE,USAGE'::text)) AND (relkind = 'S'::"char")) 

Well, there's the problem: for some reason the planner is deciding to
execute the privilege test before the relkind check.

>> Perhaps this is some fancy kind of catalog corruption…

> Maybe, as this does not happen with another instance.

It doesn't happen for me either.  Looking at the planner code, it seems
like the relkind check should happen first because it'd be cheaper than
the OR condition.  Have you perhaps messed with the cost attributed to
pg_has_role(), has_sequence_privilege(), or chareq()?  You could
investigate with, eg,

select oid::regprocedure, procost from pg_proc
  where proname = 'has_sequence_privilege';

            regards, tom lane


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

Предыдущее
От: Subodh Kumar
Дата:
Сообщение: creating table without columns
Следующее
От: Axel Rau
Дата:
Сообщение: Re: Getting fancy errors when accessing information_schema on 10.5