pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Axel Rau <Axel.Rau@Chaos1.DE>
Cc: pgsql-admin@postgresql.org
Subject: Re: Getting fancy errors when accessing information_schema on 10.5
Date: Tue, 30 Oct 2018 09:45:34 -0400
Message-ID: <15908.1540907134@sss.pgh.pa.us> (raw)
In-Reply-To: <31055688b81895792fa7d8c61e07dca7add3dbb9.camel@cybertec.at>
References: <D8BA4170-2E96-42BE-8CEC-E9FCF75B0DD4@Chaos1.DE>
	<4880e067723cefc1dc2e08a117f96de26ae0f797.camel@cybertec.at>
	<44D4C7B1-0DCF-4166-9DB8-B5D75EB2985E@Chaos1.DE>
	<20191.1540901834@sss.pgh.pa.us>
	<31055688b81895792fa7d8c61e07dca7add3dbb9.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> Tom Lane wrote:
>> 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.

> It is still unclear why the execution plan looks like that, but maybe
> it would be more robust to change "has_sequence_privilege" so that it
> just returns FALSE if the argument is not a sequence.

I was wondering about that, but somewhere along there we'd be losing
all semblance of error checking on the OID argument, so it's not all
that attractive a solution.  I'd prefer to understand why this isn't
behaving the same as it does for other people before we resort to that.

Axel, would you try two more things on that DB?

explain select ((pg_has_role(relowner, 'USAGE'::text) OR has_sequence_privilege(oid, 'SELECT, UPDATE, USAGE'::text))) from pg_class;

explain select (relkind = 'S'::"char") from pg_class;

That's just to positively confirm that the planner thinks the former
expression is more expensive than the latter.

Assuming that it does, the only other answer I can think of is that
there's something wrong with the insertion sort code in
order_qual_clauses.  Pretty hard to see what, though.

			regards, tom lane




view thread (15+ messages)  latest in thread

Message-ID: <15908.1540907134@sss.pgh.pa.us>
Permalink:  ../15908.1540907134@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15908.1540907134@sss.pgh.pa.us

 · 

reply

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, laurenz.albe@cybertec.at, Axel.Rau@Chaos1.DE
  Subject: Re: Getting fancy errors when accessing information_schema on 10.5
  In-Reply-To: <15908.1540907134@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