Re: [HACKERS] Macros bundling RELKIND_* conditions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: [HACKERS] Macros bundling RELKIND_* conditions
Date: 2018-12-19 18:29:48
Message-ID: 16982.1545244188@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2017-Aug-02, Tom Lane wrote:
>> I think Peter's got the error and the detail backwards. It should be
>> more like
>> ERROR: "someview" cannot have constraints
>> DETAIL: "someview" is a view.
>> If we do it like that, we need one ERROR message per error reason,
>> and one DETAIL per relkind, which should be manageable.

> I support this idea. Here's a proof-of-concept patch that corresponds
> to one of the cases that Ashutosh was on about (specifically, the one
> that uses the RELKIND_CAN_HAVE_STORAGE macro I just added). If there
> are no objections to this approach, I'm going to complete it along these
> lines.

+1

> I put the new function at the bottom of heapam.c but I think it probably
> needs a better place.

catalog/catalog.c contains some functions with roughly this kind of
knowledge, so maybe there?

Also, please declare the argument as "const char *relname"; and
shouldn't we use quotes around the relname in the messages?

> BTW are there other opinions on the RELKIND_HAS_STORAGE vs.
> RELKIND_CAN_HAVE_STORAGE debate? I'm inclined to change it to the
> former.

I like RELKIND_HAS_STORAGE. The other seems to imply that some rels
of a relkind have storage and others don't, which seems like a mess.
(Although maybe foreign tables would act like that?)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darafei Komяpa Praliaskouski 2018-12-19 18:37:00 Re: What to name the current heap after pluggable storage / what to rename?
Previous Message Alvaro Herrera 2018-12-19 18:07:31 Re: [HACKERS] Macros bundling RELKIND_* conditions