mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Add SQL-accessible functions for inspecting index AM properties.
Per discussion, we should provide such functions to replace the lost ability to discover AM properties by inspecting pg_am (cf commit65c5fcd35
). The added functionality is also meant to displace any code that was looking directly at pg_index.indoption, since we'd rather not believe that the bit meanings in that field are part of any client API contract. As future-proofing, define the SQL API to not assume that properties that are currently AM-wide or index-wide will remain so unless they logically must be; instead, expose them only when inquiring about a specific index or even specific index column. Also provide the ability for an index AM to override the behavior. In passing, document pg_am.amtype, overlooked in commit473b93287
. Andrew Gierth, with kibitzing by me and others Discussion: <87mvl5on7n.fsf@news-spur.riddles.org.uk>
This commit is contained in:
@ -366,7 +366,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
stmt->amname)));
|
||||
|
||||
amoid = HeapTupleGetOid(tup);
|
||||
amroutine = GetIndexAmRoutineByAmId(amoid);
|
||||
amroutine = GetIndexAmRoutineByAmId(amoid, false);
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
maxOpNumber = amroutine->amstrategies;
|
||||
@ -791,7 +791,7 @@ AlterOpFamily(AlterOpFamilyStmt *stmt)
|
||||
stmt->amname)));
|
||||
|
||||
amoid = HeapTupleGetOid(tup);
|
||||
amroutine = GetIndexAmRoutineByAmId(amoid);
|
||||
amroutine = GetIndexAmRoutineByAmId(amoid, false);
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
maxOpNumber = amroutine->amstrategies;
|
||||
@ -1103,7 +1103,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
|
||||
* the family has been created but not yet populated with the required
|
||||
* operators.)
|
||||
*/
|
||||
IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(amoid);
|
||||
IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(amoid, false);
|
||||
|
||||
if (!amroutine->amcanorderbyop)
|
||||
ereport(ERROR,
|
||||
|
Reference in New Issue
Block a user