Re: Getting fancy errors when accessing information_schema on 10.5

From: Axel Rau <Axel(dot)Rau(at)Chaos1(dot)DE>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Getting fancy errors when accessing information_schema on 10.5
Date: 2018-10-30 14:35:39
Message-ID: EC747F72-288E-4F97-A56E-BD54D9507B4D@Chaos1.DE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

> Am 30.10.2018 um 14:45 schrieb Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at <mailto:laurenz(dot)albe(at)cybertec(dot)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;

nextcloud=> explain select ((pg_has_role(relowner, 'USAGE'::text) OR has_sequence_privilege(oid, 'SELECT, UPDATE, USAGE'::text))) from pg_class;
QUERY PLAN
-----------------------------------------------------------
Seq Scan on pg_class (cost=0.00..28.56 rows=656 width=1)
(1 row)

nextcloud=> explain select (relkind = 'S'::"char") from pg_class;
QUERY PLAN
-----------------------------------------------------------
Seq Scan on pg_class (cost=0.00..28.56 rows=656 width=1)
(1 row)

>
> 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.

Axel
---
PGP-Key:29E99DD6 ☀ computing @ chaos claudius

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2018-10-30 14:40:34 Re: Getting fancy errors when accessing information_schema on 10.5
Previous Message Tom Lane 2018-10-30 13:45:34 Re: Getting fancy errors when accessing information_schema on 10.5

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergei Kornilov 2018-10-30 14:39:45 Re: [HACKERS] generated columns
Previous Message Erik Rijkers 2018-10-30 14:19:02 Re: [HACKERS] generated columns