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?
This is starting to look good.
However I don't like the naming differences between validate_opclass and amvalidate. If you expect that the current amvalidate will only be used for opclass validation then it should be renamed accordingly.
validate_opclass was renamed to amvalidate.
Also GetIndexAmRoutine should check the return type of the amhandler.
Fixed.
See the attached patch.
Whhat I don't understand from this thread if we should wait 2ndQuadrant for their sequence and column AMs or just start to work on committing it ? Alvaro, where are you ?
------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company