Re: Getting fancy errors when accessing information_schema on 10.5 - Mailing list pgsql-admin

From Tom Lane
Subject Re: Getting fancy errors when accessing information_schema on 10.5
Date
Msg-id 15908.1540907134@sss.pgh.pa.us
Whole thread Raw
In response to Re: Getting fancy errors when accessing information_schema on 10.5  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Getting fancy errors when accessing information_schema on 10.5
List pgsql-admin
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)))
frompg_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


pgsql-admin by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Getting fancy errors when accessing information_schema on 10.5
Next
From: Axel Rau
Date:
Subject: Re: Getting fancy errors when accessing information_schema on 10.5