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

From Alexander Korotkov
Subject Re: WIP: Rework access method interface
Date
Msg-id CAPpHfduGY=KZSBPZN5+USTXev-9M2PAUp3Yi=SYFDo2N244P-A@mail.gmail.com
Whole thread Raw
In response to Re: WIP: Rework access method interface  (Petr Jelinek <petr@2ndquadrant.com>)
Responses Re: WIP: Rework access method interface  (Petr Jelinek <petr@2ndquadrant.com>)
List pgsql-hackers
On Mon, Aug 31, 2015 at 1:28 PM, Petr Jelinek <petr@2ndquadrant.com> wrote:
On 2015-08-27 15:15, Alexander Korotkov wrote:
On Wed, Aug 26, 2015 at 7:20 PM, Alexander Korotkov
<a.korotkov@postgrespro.ru <mailto:a.korotkov@postgrespro.ru>> wrote:
    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.


Should I try to implement such new access method function, say 'amvalidate'?


Makes sense to me to do that, should be probably optional though.


Attached patch is implementing this. It doesn't pretend to be fully correct implementation, but it should be enough for proof the concept.
In this patch access method exposes another function: amvalidate. It takes data structure representing opclass and throws error if it finds it invalid.
This method is used on new opclass definition (alter operator family etc. are not yet implemented but planned). Also, there is SQL function validate_opclass(oid) which is used in regression tests.
Any thoughts?

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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Non-volatile variables used for spinlock manipulation
Next
From: Michael Paquier
Date:
Subject: Re: Fwd: Core dump with nested CREATE TEMP TABLE