Re: Macros bundling RELKIND_* conditions

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: Macros bundling RELKIND_* conditions
Date: 2017-08-03 15:45:34
Message-ID: 20170803154534.usaswm3vziapm7fa@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway wrote:
> On 08/02/2017 10:52 PM, Ashutosh Bapat wrote:
> > On Wed, Aug 2, 2017 at 11:15 PM, Alvaro Herrera
> > <alvherre(at)2ndquadrant(dot)com> wrote:
> >> Alvaro Herrera wrote:
> >>> I think pg_class is a reasonable place to put more generic relkind lists
> >>> alongside a matching error message for each, rather than specialized
> >>> "does this relkind have storage" macros. What about something like a
> >>> struct list in pg_class.h,
> >>
> >> I just noticed that this doesn't help at all with the initial problem
> >> statement, which is that some of the relkind checks failed to notice
> >> that partitioned tables needed to be added to the set. Maybe it still
> >> helps because you have something to grep for, as Tom proposed elsewhere.
> >
> > Having something like relkind_i_t_T, though correct, doesn't make the
> > test readable. That's another improvement because of using such
> > macros. The macro name tells the purpose of the test, which is what a
> > reader would be interested in, rather than the actual values used.
>
> +1

So add another layer:

#define RELKIND_HAS_STORAGE relkind_i_t_T

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2017-08-03 15:49:50 Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values
Previous Message Robert Haas 2017-08-03 14:45:50 Re: intermittent failures in Cygwin from select_parallel tests