Re: WIP: Rework access method interface

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: WIP: Rework access method interface
Date: 2015-09-04 14:26:36
Message-ID: CAPpHfduGY=KZSBPZN5+USTXev-9M2PAUp3Yi=SYFDo2N244P-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 31, 2015 at 1:28 PM, Petr Jelinek <petr(at)2ndquadrant(dot)com> wrote:

> On 2015-08-27 15:15, Alexander Korotkov wrote:
>
>> On Wed, Aug 26, 2015 at 7:20 PM, Alexander Korotkov
>> <a(dot)korotkov(at)postgrespro(dot)ru <mailto:a(dot)korotkov(at)postgrespro(dot)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 Content-Type Size
aminterface-3.patch application/octet-stream 236.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-09-04 14:46:39 Re: Fwd: Core dump with nested CREATE TEMP TABLE
Previous Message Andres Freund 2015-09-04 14:14:26 Re: Non-volatile variables used for spinlock manipulation