Re: WIP: Rework access method interface - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: WIP: Rework access method interface
Date
Msg-id CAPpHfdvipSj5dsRfJA7qhR9pjDL+fOr4z1C+C3qP_i-+n6Umaw@mail.gmail.com
Whole thread Raw
In response to Re: WIP: Rework access method interface  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WIP: Rework access method interface
List pgsql-hackers
On Wed, Aug 26, 2015 at 6:50 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> OK. So, as we mentioned before, if we need to expose something of am
> parameters at SQL-level then we need to write special functions which would
> call amhandler and expose it.
> Did we come to the agreement on this solution?

I think we were agreed that we should write functions to expose whatever
needs to be visible at SQL level.  I'm not sure that we had a consensus
on exactly which things need to be visible.

One thought here is that we might not want to just blindly duplicate
the existing pg_am behavior anyway.  For example, the main use of the
amstrategies column was to allow validation of pg_amop.amopstrategy
entries --- but in 4 out of the 6 existing AMs, knowledge of the AM alone
isn't sufficient information to determine the valid set of strategy
numbers anyway.  So inventing a "pg_amstrategies(am oid)" function seems
like it would be repeating a previous failure.  Not quite sure what to
do instead, though.  We could imagine something like "pg_amstrategies(am
oid, opclass oid)", but I don't see how to implement it without asking
opclasses to provide a validation function, which maybe is a change we
don't want to take on here.

Could we add another function to access method interface which would validate opclass?
Am could validate this way not only strategies, but also supporting functions. For instance, in GIN, we now require opclass to specify at least one of consistent and triconsistent. ISTM I would be nice to let the access method check such conditions. Also, we would be able to check opclass correction on its creation. Now one can create opclass with missing support functions which doesn't work.
In the SQL-level we can create function which validates opclass using this new method. This function can be used in regression tests.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Function accepting array of complex type
Next
From: Tom Lane
Date:
Subject: Re: 9.4 broken on alpha