Re: pgsql: Remove some dead code in selfuncs.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Re: pgsql: Remove some dead code in selfuncs.c
Date: 2023-01-19 17:37:24
Message-ID: 4177931.1674149844@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> On 2023-Jan-19, Tom Lane wrote:
>> Ah, sorry, -ENOCAFFEINE. It's talking about the access-as-user field,
>> not the relation's owner. I agree that as querytrees are currently
>> built, this is probably a safe optimization. But do we really want
>> to hard-wire such a subtle assumption to gain a microscopic speed
>> benefit? It's not as though GetUserId() is expensive.

> Well, I didn't see it as an optimization but rather a removal of
> confusing code. Given the current RTEPermissionInfo representation,
> it's just not possible for an "otherrel" to have a different
> access-as-user value than what "the relation mentioned in the query"
> has -- by construction, they share the same RTEPermissionInfo.

> If we wanted to decouple selfuncs.c from that knowledge, then what we
> should be doing is obtain the RTEPermissionInfo for the relation, and
> use the userid from there. But the code I deleted wasn't doing that, it
> was just using the same 'onerel' all the time. It's not difficult (or
> expensive) to do otherwise, but it seems somewhat pointless.

Hmm. Point taken, and I agree that it's not worth adding complication
that wasn't there before to track this. No further objection.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-01-19 21:21:52 pgsql: Fix ts_headline() to handle ORs and phrase queries more honestly
Previous Message Tom Lane 2023-01-19 17:24:02 pgsql: Log the correct ending timestamp in recovery_target_xid mode.