From: Tom Lane <tgl@sss.pgh.pa.us>
To: Axel Rau <Axel.Rau@Chaos1.DE>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-admin@postgresql.org
Subject: Re: Getting fancy errors when accessing information_schema on 10.5
Date: Tue, 30 Oct 2018 08:17:14 -0400
Message-ID: <20191.1540901834@sss.pgh.pa.us> (raw)
In-Reply-To: <44D4C7B1-0DCF-4166-9DB8-B5D75EB2985E@Chaos1.DE>
References: <D8BA4170-2E96-42BE-8CEC-E9FCF75B0DD4@Chaos1.DE>
<4880e067723cefc1dc2e08a117f96de26ae0f797.camel@cybertec.at>
<44D4C7B1-0DCF-4166-9DB8-B5D75EB2985E@Chaos1.DE>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, Axel.Rau@Chaos1.DE, laurenz.albe@cybertec.at
Subject: Re: Getting fancy errors when accessing information_schema on 10.5
In-Reply-To: <20191.1540901834@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox