mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Replace simple constant pg_am.amcanreturn with an AM support function.
The need for this was debated when we put in the index-only-scan feature, but at the time we had no near-term expectation of having AMs that could support such scans for only some indexes; so we kept it simple. However, the SP-GiST AM forces the issue, so let's fix it. This patch only installs the new API; no behavior actually changes.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
* index_getbitmap - get all tuples from a scan
|
||||
* index_bulk_delete - bulk deletion of index tuples
|
||||
* index_vacuum_cleanup - post-deletion cleanup of an index
|
||||
* index_can_return - does index support index-only scans?
|
||||
* index_getprocid - get a support procedure OID
|
||||
* index_getprocinfo - get a support procedure's lookup info
|
||||
*
|
||||
@@ -711,6 +712,27 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* index_can_return - does index support index-only scans?
|
||||
* ----------------
|
||||
*/
|
||||
bool
|
||||
index_can_return(Relation indexRelation)
|
||||
{
|
||||
FmgrInfo *procedure;
|
||||
|
||||
RELATION_CHECKS;
|
||||
|
||||
/* amcanreturn is optional; assume FALSE if not provided by AM */
|
||||
if (!RegProcedureIsValid(indexRelation->rd_am->amcanreturn))
|
||||
return false;
|
||||
|
||||
GET_REL_PROCEDURE(amcanreturn);
|
||||
|
||||
return DatumGetBool(FunctionCall1(procedure,
|
||||
PointerGetDatum(indexRelation)));
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* index_getprocid
|
||||
*
|
||||
|
Reference in New Issue
Block a user