Re: Change RangeVarGetRelidExtended() to take flags argument?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change RangeVarGetRelidExtended() to take flags argument?
Date: 2018-03-31 00:09:42
Message-ID: 20180331000942.pg2loaxbab4p2tgk@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-03-30 11:37:19 +0900, Michael Paquier wrote:
> On Thu, Mar 29, 2018 at 05:15:14PM -0700, Andres Freund wrote:
> > On 2018-03-22 15:45:23 +0000, Bossart, Nathan wrote:
> >> Here is a set of patches for this approach.
> >
> > To me this looks like a reasonable approach that'd solve the VACUUM
> > use-case. I think we can live with the API breakage, but I'd like to
> > have some more comments? Pertinent parts quoted below.
>
> I just looked at the proposed patches, that looks like a sensible
> approach.
>
> >> + /* verify that conflicting options are not specified */
> >> + Assert((flags & (RELID_NOWAIT | RELID_SKIP_LOCKED)) != (RELID_NOWAIT | RELID_SKIP_LOCKED));
> >> +
>
> This is more readable as follows I think:
> Assert((flags & RELID_NOWAIT) == 0 || (flags & RELID_SKIP_LOCKED) == 0);

I found Assert(!((flags & RELID_NOWAIT) && (flags & RELID_SKIP_LOCKED)))
easier. I've removed a number of of parens from, in my opinion,
over-parenthized statements.

On 2018-03-30 14:55:45 -0700, Andres Freund wrote:
> On 2018-03-30 17:08:26 +0000, Bossart, Nathan wrote:
> > +typedef enum RelidOption
> > +{
> > + RELID_MISSING_OK = 1 << 0, /* don't error if relation doesn't exist */
> > + RELID_NOWAIT = 1 << 1 /* error if relation cannot be locked */
> > +} RelidOption;
>
> I don't like the Relid prefix here. RangeVarGetRelid deals with
> *rangevars*, and returns a relation oid. ISTM it'd be more accurate to
> call this RV_* or RVID_*. Counterarguments, preferences?

Went with RVR_*

Pushed.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-31 00:19:46 Re: BUG #14941: Vacuum crashes
Previous Message Tomas Vondra 2018-03-31 00:08:45 Re: Online enabling of checksums