Re: [PATCH] Do not use StdRdOptions in Access Methods - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] Do not use StdRdOptions in Access Methods
Date
Msg-id 20191115013449.GA1849@paquier.xyz
Whole thread Raw
In response to Re: [PATCH] Do not use StdRdOptions in Access Methods  (Nikolay Shaplov <dhyan@nataraj.su>)
Responses Re: [PATCH] Do not use StdRdOptions in Access Methods
List pgsql-hackers
On Thu, Nov 14, 2019 at 11:20:25AM +0300, Nikolay Shaplov wrote:
> For me there is no mush sense in it, as it does not prevent us from wrong type
> casting. Indexes can use all kinds of structures for reloptions, and checking
> that this is index, will not do much.

It seems to me that if the plan is to have one option structure for
each index AM, which has actually the advantage to reduce the bloat of
each relcache entry currently relying on StdRdOptions, then we could
have those extra assertion checks in the same patch, because the new
macros are introduced.

> Do you know way how to distinguish one index from another? If we can check in
> assertion this is index, and this index is spgist, then assertion will make
> sense for 100%. I just have no idea how to do it. As far as I can see it is
> not possible now.

There is rd_rel->relam.  You can for example refer to pgstatindex.c
which has AM-related checks to make sure that the correct index AM is
being used.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: SKIP_LOCKED test causes random buildfarm failures
Next
From: Michael Paquier
Date:
Subject: Re: could not stat promote trigger file leads to shutdown