LCOV - code coverage report
Current view: top level - src/backend/access/index - genam.c (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 94.9 % 254 241
Test Date: 2026-09-26 14:15:41 Functions: 100.0 % 15 15
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 72.7 % 128 93

             Branch data     Line data    Source code
       1                 :             : /*-------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * genam.c
       4                 :             :  *    general index access method routines
       5                 :             :  *
       6                 :             :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
       7                 :             :  * Portions Copyright (c) 1994, Regents of the University of California
       8                 :             :  *
       9                 :             :  *
      10                 :             :  * IDENTIFICATION
      11                 :             :  *    src/backend/access/index/genam.c
      12                 :             :  *
      13                 :             :  * NOTES
      14                 :             :  *    many of the old access method routines have been turned into
      15                 :             :  *    macros and moved to genam.h -cim 4/30/91
      16                 :             :  *
      17                 :             :  *-------------------------------------------------------------------------
      18                 :             :  */
      19                 :             : 
      20                 :             : #include "postgres.h"
      21                 :             : 
      22                 :             : #include "access/genam.h"
      23                 :             : #include "access/heapam.h"
      24                 :             : #include "access/relscan.h"
      25                 :             : #include "access/tableam.h"
      26                 :             : #include "access/transam.h"
      27                 :             : #include "catalog/index.h"
      28                 :             : #include "lib/stringinfo.h"
      29                 :             : #include "miscadmin.h"
      30                 :             : #include "storage/bufmgr.h"
      31                 :             : #include "storage/procarray.h"
      32                 :             : #include "utils/acl.h"
      33                 :             : #include "utils/injection_point.h"
      34                 :             : #include "utils/lsyscache.h"
      35                 :             : #include "utils/rel.h"
      36                 :             : #include "utils/rls.h"
      37                 :             : #include "utils/ruleutils.h"
      38                 :             : #include "utils/snapmgr.h"
      39                 :             : 
      40                 :             : 
      41                 :             : /* ----------------------------------------------------------------
      42                 :             :  *      general access method routines
      43                 :             :  *
      44                 :             :  *      All indexed access methods use an identical scan structure.
      45                 :             :  *      We don't know how the various AMs do locking, however, so we don't
      46                 :             :  *      do anything about that here.
      47                 :             :  *
      48                 :             :  *      The intent is that an AM implementor will define a beginscan routine
      49                 :             :  *      that calls RelationGetIndexScan, to fill in the scan, and then does
      50                 :             :  *      whatever kind of locking he wants.
      51                 :             :  *
      52                 :             :  *      At the end of a scan, the AM's endscan routine undoes the locking,
      53                 :             :  *      but does *not* call IndexScanEnd --- the higher-level index_endscan
      54                 :             :  *      routine does that.  (We can't do it in the AM because index_endscan
      55                 :             :  *      still needs to touch the IndexScanDesc after calling the AM.)
      56                 :             :  *
      57                 :             :  *      Because of this, the AM does not have a choice whether to call
      58                 :             :  *      RelationGetIndexScan or not; its beginscan routine must return an
      59                 :             :  *      object made by RelationGetIndexScan.  This is kinda ugly but not
      60                 :             :  *      worth cleaning up now.
      61                 :             :  * ----------------------------------------------------------------
      62                 :             :  */
      63                 :             : 
      64                 :             : /* ----------------
      65                 :             :  *  RelationGetIndexScan -- Create and fill an IndexScanDesc.
      66                 :             :  *
      67                 :             :  *      This routine creates an index scan structure and sets up initial
      68                 :             :  *      contents for it.
      69                 :             :  *
      70                 :             :  *      Parameters:
      71                 :             :  *              indexRelation -- index relation for scan.
      72                 :             :  *              nkeys -- count of scan keys (index qual conditions).
      73                 :             :  *              norderbys -- count of index order-by operators.
      74                 :             :  *
      75                 :             :  *      Returns:
      76                 :             :  *              An initialized IndexScanDesc.
      77                 :             :  * ----------------
      78                 :             :  */
      79                 :             : IndexScanDesc
      80                 :     9582790 : RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys)
      81                 :             : {
      82                 :             :     IndexScanDesc scan;
      83                 :             : 
      84                 :     9582790 :     scan = palloc_object(IndexScanDescData);
      85                 :             : 
      86                 :     9582790 :     scan->heapRelation = NULL;   /* may be set later */
      87                 :     9582790 :     scan->xs_table_opaque = NULL;
      88                 :     9582790 :     scan->indexRelation = indexRelation;
      89                 :     9582790 :     scan->xs_snapshot = InvalidSnapshot; /* caller must initialize this */
      90                 :     9582790 :     scan->numberOfKeys = nkeys;
      91                 :     9582790 :     scan->numberOfOrderBys = norderbys;
      92                 :             : 
      93                 :             :     /*
      94                 :             :      * We allocate key workspace here, but it won't get filled until amrescan.
      95                 :             :      */
      96         [ +  + ]:     9582790 :     if (nkeys > 0)
      97                 :     9574730 :         scan->keyData = palloc_array(ScanKeyData, nkeys);
      98                 :             :     else
      99                 :        8060 :         scan->keyData = NULL;
     100         [ +  + ]:     9582790 :     if (norderbys > 0)
     101                 :         119 :         scan->orderByData = palloc_array(ScanKeyData, norderbys);
     102                 :             :     else
     103                 :     9582671 :         scan->orderByData = NULL;
     104                 :             : 
     105                 :     9582790 :     scan->xs_want_itup = false; /* may be set later */
     106                 :             : 
     107                 :             :     /*
     108                 :             :      * During recovery we ignore killed tuples and don't bother to kill them
     109                 :             :      * either. We do this because the xmin on the primary node could easily be
     110                 :             :      * later than the xmin on the standby node, so that what the primary
     111                 :             :      * thinks is killed is supposed to be visible on standby. So for correct
     112                 :             :      * MVCC for queries during recovery we must ignore these hints and check
     113                 :             :      * all tuples. Do *not* set ignore_killed_tuples to true when running in a
     114                 :             :      * transaction that was started during recovery. xactStartedInRecovery
     115                 :             :      * should not be altered by index AMs.
     116                 :             :      */
     117                 :     9582790 :     scan->kill_prior_tuple = false;
     118                 :     9582790 :     scan->xactStartedInRecovery = TransactionStartedDuringRecovery();
     119                 :     9582790 :     scan->ignore_killed_tuples = !scan->xactStartedInRecovery;
     120                 :             : 
     121                 :     9582790 :     scan->opaque = NULL;
     122                 :     9582790 :     scan->instrument = NULL;
     123                 :             : 
     124                 :     9582790 :     scan->xs_itup = NULL;
     125                 :     9582790 :     scan->xs_itupdesc = NULL;
     126                 :     9582790 :     scan->xs_hitup = NULL;
     127                 :     9582790 :     scan->xs_hitupdesc = NULL;
     128                 :             : 
     129                 :     9582790 :     scan->xs_getnext_slot = NULL;
     130                 :             : 
     131                 :     9582790 :     scan->xs_name_cstring_attnums = NULL;
     132                 :     9582790 :     scan->xs_name_cstring_buf = NULL;
     133                 :     9582790 :     scan->xs_name_cstring_count = 0;
     134                 :             : 
     135                 :     9582790 :     scan->xs_visited_pages_limit = 0;
     136                 :             : 
     137                 :     9582790 :     return scan;
     138                 :             : }
     139                 :             : 
     140                 :             : /* ----------------
     141                 :             :  *  IndexScanEnd -- End an index scan.
     142                 :             :  *
     143                 :             :  *      This routine just releases the storage acquired by
     144                 :             :  *      RelationGetIndexScan().  Any AM-level resources are
     145                 :             :  *      assumed to already have been released by the AM's
     146                 :             :  *      endscan routine.
     147                 :             :  *
     148                 :             :  *  Returns:
     149                 :             :  *      None.
     150                 :             :  * ----------------
     151                 :             :  */
     152                 :             : void
     153                 :     9581495 : IndexScanEnd(IndexScanDesc scan)
     154                 :             : {
     155         [ +  + ]:     9581495 :     if (scan->keyData != NULL)
     156                 :     9573459 :         pfree(scan->keyData);
     157         [ +  + ]:     9581495 :     if (scan->orderByData != NULL)
     158                 :         115 :         pfree(scan->orderByData);
     159         [ +  + ]:     9581495 :     if (scan->xs_name_cstring_attnums != NULL)
     160                 :        6167 :         pfree(scan->xs_name_cstring_attnums);
     161         [ +  + ]:     9581495 :     if (scan->xs_name_cstring_buf != NULL)
     162                 :        6167 :         pfree(scan->xs_name_cstring_buf);
     163                 :             : 
     164                 :     9581495 :     pfree(scan);
     165                 :     9581495 : }
     166                 :             : 
     167                 :             : /*
     168                 :             :  * BuildIndexValueDescription
     169                 :             :  *
     170                 :             :  * Construct a string describing the contents of an index entry, in the
     171                 :             :  * form "(key_name, ...)=(key_value, ...)".  This is currently used
     172                 :             :  * for building unique-constraint, exclusion-constraint error messages, and
     173                 :             :  * logical replication conflict error messages so only key columns of the index
     174                 :             :  * are checked and printed.
     175                 :             :  *
     176                 :             :  * Note that if the user does not have permissions to view all of the
     177                 :             :  * columns involved then a NULL is returned.  Returning a partial key seems
     178                 :             :  * unlikely to be useful and we have no way to know which of the columns the
     179                 :             :  * user provided (unlike in ExecBuildSlotValueDescription).
     180                 :             :  *
     181                 :             :  * The passed-in values/nulls arrays are the "raw" input to the index AM,
     182                 :             :  * e.g. results of FormIndexDatum --- this is not necessarily what is stored
     183                 :             :  * in the index, but it's what the user perceives to be stored.
     184                 :             :  *
     185                 :             :  * Note: if you change anything here, check whether
     186                 :             :  * ExecBuildSlotPartitionKeyDescription() in execMain.c needs a similar
     187                 :             :  * change.
     188                 :             :  */
     189                 :             : char *
     190                 :         802 : BuildIndexValueDescription(Relation indexRelation,
     191                 :             :                            const Datum *values, const bool *isnull)
     192                 :             : {
     193                 :             :     StringInfoData buf;
     194                 :             :     Form_pg_index idxrec;
     195                 :             :     int         indnkeyatts;
     196                 :             :     int         i;
     197                 :             :     int         keyno;
     198                 :         802 :     Oid         indexrelid = RelationGetRelid(indexRelation);
     199                 :             :     Oid         indrelid;
     200                 :             :     AclResult   aclresult;
     201                 :             : 
     202                 :         802 :     indnkeyatts = IndexRelationGetNumberOfKeyAttributes(indexRelation);
     203                 :             : 
     204                 :             :     /*
     205                 :             :      * Check permissions- if the user does not have access to view all of the
     206                 :             :      * key columns then return NULL to avoid leaking data.
     207                 :             :      *
     208                 :             :      * First check if RLS is enabled for the relation.  If so, return NULL to
     209                 :             :      * avoid leaking data.
     210                 :             :      *
     211                 :             :      * Next we need to check table-level SELECT access and then, if there is
     212                 :             :      * no access there, check column-level permissions.
     213                 :             :      */
     214                 :         802 :     idxrec = indexRelation->rd_index;
     215                 :         802 :     indrelid = idxrec->indrelid;
     216                 :             :     Assert(indexrelid == idxrec->indexrelid);
     217                 :             : 
     218                 :             :     /* RLS check- if RLS is enabled then we don't return anything. */
     219         [ +  + ]:         802 :     if (check_enable_rls(indrelid, InvalidOid, true) == RLS_ENABLED)
     220                 :           8 :         return NULL;
     221                 :             : 
     222                 :             :     /* Table-level SELECT is enough, if the user has it */
     223                 :         794 :     aclresult = pg_class_aclcheck(indrelid, GetUserId(), ACL_SELECT);
     224         [ +  + ]:         794 :     if (aclresult != ACLCHECK_OK)
     225                 :             :     {
     226                 :             :         /*
     227                 :             :          * No table-level access, so step through the columns in the index and
     228                 :             :          * make sure the user has SELECT rights on all of them.
     229                 :             :          */
     230         [ +  - ]:          16 :         for (keyno = 0; keyno < indnkeyatts; keyno++)
     231                 :             :         {
     232                 :          16 :             AttrNumber  attnum = idxrec->indkey.values[keyno];
     233                 :             : 
     234                 :             :             /*
     235                 :             :              * Note that if attnum == InvalidAttrNumber, then this is an index
     236                 :             :              * based on an expression and we return no detail rather than try
     237                 :             :              * to figure out what column(s) the expression includes and if the
     238                 :             :              * user has SELECT rights on them.
     239                 :             :              */
     240   [ +  -  +  + ]:          32 :             if (attnum == InvalidAttrNumber ||
     241                 :          16 :                 pg_attribute_aclcheck(indrelid, attnum, GetUserId(),
     242                 :             :                                       ACL_SELECT) != ACLCHECK_OK)
     243                 :             :             {
     244                 :             :                 /* No access, so clean up and return */
     245                 :           8 :                 return NULL;
     246                 :             :             }
     247                 :             :         }
     248                 :             :     }
     249                 :             : 
     250                 :         786 :     initStringInfo(&buf);
     251                 :         786 :     appendStringInfo(&buf, "(%s)=(",
     252                 :             :                      pg_get_indexdef_columns(indexrelid, true));
     253                 :             : 
     254         [ +  + ]:        1834 :     for (i = 0; i < indnkeyatts; i++)
     255                 :             :     {
     256                 :             :         char       *val;
     257                 :             : 
     258         [ +  + ]:        1048 :         if (isnull[i])
     259                 :          28 :             val = "null";
     260                 :             :         else
     261                 :             :         {
     262                 :             :             Oid         foutoid;
     263                 :             :             bool        typisvarlena;
     264                 :             : 
     265                 :             :             /*
     266                 :             :              * The provided data is not necessarily of the type stored in the
     267                 :             :              * index; rather it is of the index opclass's input type. So look
     268                 :             :              * at rd_opcintype not the index tupdesc.
     269                 :             :              *
     270                 :             :              * Note: this is a bit shaky for opclasses that have pseudotype
     271                 :             :              * input types such as ANYARRAY or RECORD.  Currently, the
     272                 :             :              * typoutput functions associated with the pseudotypes will work
     273                 :             :              * okay, but we might have to try harder in future.
     274                 :             :              */
     275                 :        1020 :             getTypeOutputInfo(indexRelation->rd_opcintype[i],
     276                 :             :                               &foutoid, &typisvarlena);
     277                 :        1020 :             val = OidOutputFunctionCall(foutoid, values[i]);
     278                 :             :         }
     279                 :             : 
     280         [ +  + ]:        1048 :         if (i > 0)
     281                 :         262 :             appendStringInfoString(&buf, ", ");
     282                 :        1048 :         appendStringInfoString(&buf, val);
     283                 :             :     }
     284                 :             : 
     285                 :         786 :     appendStringInfoChar(&buf, ')');
     286                 :             : 
     287                 :         786 :     return buf.data;
     288                 :             : }
     289                 :             : 
     290                 :             : /*
     291                 :             :  * Get the snapshotConflictHorizon from the table entries pointed to by the
     292                 :             :  * index tuples being deleted using an AM-generic approach.
     293                 :             :  *
     294                 :             :  * This is a table_index_delete_tuples() shim used by index AMs that only need
     295                 :             :  * to consult the tableam to get a snapshotConflictHorizon value, and only
     296                 :             :  * expect to delete index tuples that are already known deletable (typically
     297                 :             :  * due to having LP_DEAD bits set).  When a snapshotConflictHorizon value
     298                 :             :  * isn't needed in index AM's deletion WAL record, it is safe for it to skip
     299                 :             :  * calling here entirely.
     300                 :             :  *
     301                 :             :  * We assume that caller index AM uses the standard IndexTuple representation,
     302                 :             :  * with table TIDs stored in the t_tid field.  We also expect (and assert)
     303                 :             :  * that the line pointers on page for 'itemnos' offsets are already marked
     304                 :             :  * LP_DEAD.
     305                 :             :  */
     306                 :             : TransactionId
     307                 :          16 : index_compute_xid_horizon_for_tuples(Relation irel,
     308                 :             :                                      Relation hrel,
     309                 :             :                                      Buffer ibuf,
     310                 :             :                                      OffsetNumber *itemnos,
     311                 :             :                                      int nitems)
     312                 :             : {
     313                 :             :     TM_IndexDeleteOp delstate;
     314                 :          16 :     TransactionId snapshotConflictHorizon = InvalidTransactionId;
     315                 :          16 :     Page        ipage = BufferGetPage(ibuf);
     316                 :             :     IndexTuple  itup;
     317                 :             : 
     318                 :             :     Assert(nitems > 0);
     319                 :             : 
     320                 :          16 :     delstate.irel = irel;
     321                 :          16 :     delstate.iblknum = BufferGetBlockNumber(ibuf);
     322                 :          16 :     delstate.bottomup = false;
     323                 :          16 :     delstate.bottomupfreespace = 0;
     324                 :          16 :     delstate.ndeltids = 0;
     325                 :          16 :     delstate.deltids = palloc_array(TM_IndexDelete, nitems);
     326                 :          16 :     delstate.status = palloc_array(TM_IndexStatus, nitems);
     327                 :             : 
     328                 :             :     /* identify what the index tuples about to be deleted point to */
     329         [ +  + ]:        2526 :     for (int i = 0; i < nitems; i++)
     330                 :             :     {
     331                 :        2510 :         OffsetNumber offnum = itemnos[i];
     332                 :             :         ItemId      iitemid;
     333                 :             : 
     334                 :        2510 :         iitemid = PageGetItemId(ipage, offnum);
     335                 :        2510 :         itup = (IndexTuple) PageGetItem(ipage, iitemid);
     336                 :             : 
     337                 :             :         Assert(ItemIdIsDead(iitemid));
     338                 :             : 
     339                 :        2510 :         ItemPointerCopy(&itup->t_tid, &delstate.deltids[i].tid);
     340                 :        2510 :         delstate.deltids[i].id = delstate.ndeltids;
     341                 :        2510 :         delstate.status[i].idxoffnum = offnum;
     342                 :        2510 :         delstate.status[i].knowndeletable = true;   /* LP_DEAD-marked */
     343                 :        2510 :         delstate.status[i].promising = false;   /* unused */
     344                 :        2510 :         delstate.status[i].freespace = 0;   /* unused */
     345                 :             : 
     346                 :        2510 :         delstate.ndeltids++;
     347                 :             :     }
     348                 :             : 
     349                 :             :     /* determine the actual xid horizon */
     350                 :          16 :     snapshotConflictHorizon = table_index_delete_tuples(hrel, &delstate);
     351                 :             : 
     352                 :             :     /* assert tableam agrees that all items are deletable */
     353                 :             :     Assert(delstate.ndeltids == nitems);
     354                 :             : 
     355                 :          16 :     pfree(delstate.deltids);
     356                 :          16 :     pfree(delstate.status);
     357                 :             : 
     358                 :          16 :     return snapshotConflictHorizon;
     359                 :             : }
     360                 :             : 
     361                 :             : 
     362                 :             : /* ----------------------------------------------------------------
     363                 :             :  *      heap-or-index-scan access to system catalogs
     364                 :             :  *
     365                 :             :  *      These functions support system catalog accesses that normally use
     366                 :             :  *      an index but need to be capable of being switched to heap scans
     367                 :             :  *      if the system indexes are unavailable.
     368                 :             :  *
     369                 :             :  *      The specified scan keys must be compatible with the named index.
     370                 :             :  *      Generally this means that they must constrain either all columns
     371                 :             :  *      of the index, or the first K columns of an N-column index.
     372                 :             :  *
     373                 :             :  *      These routines could work with non-system tables, actually,
     374                 :             :  *      but they're only useful when there is a known index to use with
     375                 :             :  *      the given scan keys; so in practice they're only good for
     376                 :             :  *      predetermined types of scans of system catalogs.
     377                 :             :  * ----------------------------------------------------------------
     378                 :             :  */
     379                 :             : 
     380                 :             : /*
     381                 :             :  * systable_beginscan --- set up for heap-or-index scan
     382                 :             :  *
     383                 :             :  *  rel: catalog to scan, already opened and suitably locked
     384                 :             :  *  indexId: OID of index to conditionally use
     385                 :             :  *  indexOK: if false, forces a heap scan (see notes below)
     386                 :             :  *  snapshot: time qual to use (NULL for a recent catalog snapshot)
     387                 :             :  *  nkeys, key: scan keys
     388                 :             :  *
     389                 :             :  * The attribute numbers in the scan key should be set for the heap case.
     390                 :             :  * If we choose to index, we convert them to 1..n to reference the index
     391                 :             :  * columns.  Note this means there must be one scankey qualification per
     392                 :             :  * index column!  This is checked by the Asserts in the normal, index-using
     393                 :             :  * case, but won't be checked if the heapscan path is taken.
     394                 :             :  *
     395                 :             :  * The routine checks the normal cases for whether an indexscan is safe,
     396                 :             :  * but caller can make additional checks and pass indexOK=false if needed.
     397                 :             :  * In standard case indexOK can simply be constant TRUE.
     398                 :             :  */
     399                 :             : SysScanDesc
     400                 :     9504899 : systable_beginscan(Relation heapRelation,
     401                 :             :                    Oid indexId,
     402                 :             :                    bool indexOK,
     403                 :             :                    Snapshot snapshot,
     404                 :             :                    int nkeys, ScanKey key)
     405                 :             : {
     406                 :             :     SysScanDesc sysscan;
     407                 :             :     Relation    irel;
     408                 :             : 
     409         [ +  + ]:     9504899 :     if (indexOK &&
     410         [ +  + ]:     9352368 :         !IgnoreSystemIndexes &&
     411         [ +  + ]:     9279739 :         !ReindexIsProcessingIndex(indexId))
     412                 :     9272321 :         irel = index_open(indexId, AccessShareLock);
     413                 :             :     else
     414                 :      232578 :         irel = NULL;
     415                 :             : 
     416                 :     9504895 :     sysscan = palloc_object(SysScanDescData);
     417                 :             : 
     418                 :     9504895 :     sysscan->heap_rel = heapRelation;
     419                 :     9504895 :     sysscan->irel = irel;
     420                 :     9504895 :     sysscan->slot = table_slot_create(heapRelation, NULL);
     421                 :             : 
     422         [ +  + ]:     9504895 :     if (snapshot == NULL)
     423                 :             :     {
     424                 :     8807367 :         Oid         relid = RelationGetRelid(heapRelation);
     425                 :             : 
     426                 :     8807367 :         snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
     427                 :     8807367 :         sysscan->snapshot = snapshot;
     428                 :             :     }
     429                 :             :     else
     430                 :             :     {
     431                 :             :         /* Caller is responsible for any snapshot. */
     432                 :      697528 :         sysscan->snapshot = NULL;
     433                 :             :     }
     434                 :             : 
     435                 :             :     /*
     436                 :             :      * If CheckXidAlive is set then set a flag to indicate that system table
     437                 :             :      * scan is in-progress.  See detailed comments in xact.c where these
     438                 :             :      * variables are declared.
     439                 :             :      */
     440         [ +  + ]:     9504895 :     if (TransactionIdIsValid(CheckXidAlive))
     441                 :        1006 :         bsysscan = true;
     442                 :             : 
     443         [ +  + ]:     9504895 :     if (irel)
     444                 :             :     {
     445                 :             :         int         i;
     446                 :             :         ScanKey     idxkey;
     447                 :             : 
     448                 :     9272317 :         idxkey = palloc_array(ScanKeyData, nkeys);
     449                 :             : 
     450                 :             :         /* Convert attribute numbers to be index column numbers. */
     451         [ +  + ]:    24255489 :         for (i = 0; i < nkeys; i++)
     452                 :             :         {
     453                 :             :             int         j;
     454                 :             : 
     455                 :    14983172 :             memcpy(&idxkey[i], &key[i], sizeof(ScanKeyData));
     456                 :             : 
     457         [ +  - ]:    21719277 :             for (j = 0; j < IndexRelationGetNumberOfAttributes(irel); j++)
     458                 :             :             {
     459         [ +  + ]:    21719277 :                 if (key[i].sk_attno == irel->rd_index->indkey.values[j])
     460                 :             :                 {
     461                 :    14983172 :                     idxkey[i].sk_attno = j + 1;
     462                 :    14983172 :                     break;
     463                 :             :                 }
     464                 :             :             }
     465         [ -  + ]:    14983172 :             if (j == IndexRelationGetNumberOfAttributes(irel))
     466         [ #  # ]:           0 :                 elog(ERROR, "column is not in index");
     467                 :             :         }
     468                 :             : 
     469                 :     9272317 :         sysscan->iscan = index_beginscan(heapRelation, irel, false,
     470                 :             :                                          snapshot, NULL, nkeys, 0,
     471                 :             :                                          SO_NONE);
     472                 :     9272317 :         index_rescan(sysscan->iscan, idxkey, nkeys, NULL, 0);
     473                 :     9272317 :         sysscan->scan = NULL;
     474                 :             : 
     475                 :     9272317 :         pfree(idxkey);
     476                 :             :     }
     477                 :             :     else
     478                 :             :     {
     479                 :             :         /*
     480                 :             :          * We disallow synchronized scans when forced to use a heapscan on a
     481                 :             :          * catalog.  In most cases the desired rows are near the front, so
     482                 :             :          * that the unpredictable start point of a syncscan is a serious
     483                 :             :          * disadvantage; and there are no compensating advantages, because
     484                 :             :          * it's unlikely that such scans will occur in parallel.
     485                 :             :          */
     486                 :      232578 :         sysscan->scan = table_beginscan_strat(heapRelation, snapshot,
     487                 :             :                                               nkeys, key,
     488                 :             :                                               true, false);
     489                 :      232578 :         sysscan->iscan = NULL;
     490                 :             :     }
     491                 :             : 
     492                 :     9504895 :     return sysscan;
     493                 :             : }
     494                 :             : 
     495                 :             : /*
     496                 :             :  * HandleConcurrentAbort - Handle concurrent abort of the CheckXidAlive.
     497                 :             :  *
     498                 :             :  * Error out, if CheckXidAlive is aborted. We can't directly use
     499                 :             :  * TransactionIdDidAbort as after crash such transaction might not have been
     500                 :             :  * marked as aborted.  See detailed comments in xact.c where the variable
     501                 :             :  * is declared.
     502                 :             :  */
     503                 :             : static inline void
     504                 :    19983624 : HandleConcurrentAbort(void)
     505                 :             : {
     506         [ +  + ]:    19983624 :     if (TransactionIdIsValid(CheckXidAlive) &&
     507         [ +  + ]:        1654 :         !TransactionIdIsInProgress(CheckXidAlive) &&
     508         [ +  - ]:           8 :         !TransactionIdDidCommit(CheckXidAlive))
     509         [ +  - ]:           8 :         ereport(ERROR,
     510                 :             :                 (errcode(ERRCODE_TRANSACTION_ROLLBACK),
     511                 :             :                  errmsg("transaction aborted during system catalog scan")));
     512                 :    19983616 : }
     513                 :             : 
     514                 :             : /*
     515                 :             :  * systable_getnext --- get next tuple in a heap-or-index scan
     516                 :             :  *
     517                 :             :  * Returns NULL if no more tuples available.
     518                 :             :  *
     519                 :             :  * Note that returned tuple is a reference to data in a disk buffer;
     520                 :             :  * it must not be modified, and should be presumed inaccessible after
     521                 :             :  * next getnext() or endscan() call.
     522                 :             :  *
     523                 :             :  * XXX: It'd probably make sense to offer a slot based interface, at least
     524                 :             :  * optionally.
     525                 :             :  */
     526                 :             : HeapTuple
     527                 :    19684244 : systable_getnext(SysScanDesc sysscan)
     528                 :             : {
     529                 :    19684244 :     HeapTuple   htup = NULL;
     530                 :             : 
     531         [ +  + ]:    19684244 :     if (sysscan->irel)
     532                 :             :     {
     533         [ +  + ]:    17412421 :         if (table_index_getnext_slot(sysscan->iscan, ForwardScanDirection,
     534                 :    17412421 :                                      sysscan->slot))
     535                 :             :         {
     536                 :             :             bool        shouldFree;
     537                 :             : 
     538                 :    13442885 :             htup = ExecFetchSlotHeapTuple(sysscan->slot, false, &shouldFree);
     539                 :             :             Assert(!shouldFree);
     540                 :             : 
     541                 :             :             /*
     542                 :             :              * We currently don't need to support lossy index operators for
     543                 :             :              * any system catalog scan.  It could be done here, using the scan
     544                 :             :              * keys to drive the operator calls, if we arranged to save the
     545                 :             :              * heap attnums during systable_beginscan(); this is practical
     546                 :             :              * because we still wouldn't need to support indexes on
     547                 :             :              * expressions.
     548                 :             :              */
     549         [ -  + ]:    13442885 :             if (sysscan->iscan->xs_recheck)
     550         [ #  # ]:           0 :                 elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
     551                 :             :         }
     552                 :             :     }
     553                 :             :     else
     554                 :             :     {
     555         [ +  + ]:     2271823 :         if (table_scan_getnextslot(sysscan->scan, ForwardScanDirection, sysscan->slot))
     556                 :             :         {
     557                 :             :             bool        shouldFree;
     558                 :             : 
     559                 :     2217798 :             htup = ExecFetchSlotHeapTuple(sysscan->slot, false, &shouldFree);
     560                 :             :             Assert(!shouldFree);
     561                 :             :         }
     562                 :             :     }
     563                 :             : 
     564                 :             :     /*
     565                 :             :      * Handle the concurrent abort while fetching the catalog tuple during
     566                 :             :      * logical streaming of a transaction.
     567                 :             :      */
     568                 :    19684240 :     HandleConcurrentAbort();
     569                 :             : 
     570                 :    19684232 :     return htup;
     571                 :             : }
     572                 :             : 
     573                 :             : /*
     574                 :             :  * systable_recheck_tuple --- recheck visibility of most-recently-fetched tuple
     575                 :             :  *
     576                 :             :  * In particular, determine if this tuple would be visible to a catalog scan
     577                 :             :  * that started now.  We don't handle the case of a non-MVCC scan snapshot,
     578                 :             :  * because no caller needs that yet.
     579                 :             :  *
     580                 :             :  * This is useful to test whether an object was deleted while we waited to
     581                 :             :  * acquire lock on it.
     582                 :             :  *
     583                 :             :  * Note: we don't actually *need* the tuple to be passed in, but it's a
     584                 :             :  * good crosscheck that the caller is interested in the right tuple.
     585                 :             :  */
     586                 :             : bool
     587                 :      155261 : systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup)
     588                 :             : {
     589                 :             :     Snapshot    freshsnap;
     590                 :             :     bool        result;
     591                 :             : 
     592                 :             :     Assert(tup == ExecFetchSlotHeapTuple(sysscan->slot, false, NULL));
     593                 :             : 
     594                 :      155261 :     freshsnap = GetCatalogSnapshot(RelationGetRelid(sysscan->heap_rel));
     595                 :      155261 :     freshsnap = RegisterSnapshot(freshsnap);
     596                 :             : 
     597                 :      155261 :     result = table_tuple_satisfies_snapshot(sysscan->heap_rel,
     598                 :      155261 :                                             sysscan->slot,
     599                 :             :                                             freshsnap);
     600                 :      155261 :     UnregisterSnapshot(freshsnap);
     601                 :             : 
     602                 :             :     /*
     603                 :             :      * Handle the concurrent abort while fetching the catalog tuple during
     604                 :             :      * logical streaming of a transaction.
     605                 :             :      */
     606                 :      155261 :     HandleConcurrentAbort();
     607                 :             : 
     608                 :      155261 :     return result;
     609                 :             : }
     610                 :             : 
     611                 :             : /*
     612                 :             :  * systable_endscan --- close scan, release resources
     613                 :             :  *
     614                 :             :  * Note that it's still up to the caller to close the heap relation.
     615                 :             :  */
     616                 :             : void
     617                 :     9504329 : systable_endscan(SysScanDesc sysscan)
     618                 :             : {
     619         [ +  - ]:     9504329 :     if (sysscan->slot)
     620                 :             :     {
     621                 :     9504329 :         ExecDropSingleTupleTableSlot(sysscan->slot);
     622                 :     9504329 :         sysscan->slot = NULL;
     623                 :             :     }
     624                 :             : 
     625         [ +  + ]:     9504329 :     if (sysscan->irel)
     626                 :             :     {
     627                 :     9271762 :         index_endscan(sysscan->iscan);
     628                 :     9271762 :         index_close(sysscan->irel, AccessShareLock);
     629                 :             :     }
     630                 :             :     else
     631                 :      232567 :         table_endscan(sysscan->scan);
     632                 :             : 
     633         [ +  + ]:     9504329 :     if (sysscan->snapshot)
     634                 :     8806809 :         UnregisterSnapshot(sysscan->snapshot);
     635                 :             : 
     636                 :             :     /*
     637                 :             :      * Reset the bsysscan flag at the end of the systable scan.  See detailed
     638                 :             :      * comments in xact.c where these variables are declared.
     639                 :             :      */
     640         [ +  + ]:     9504329 :     if (TransactionIdIsValid(CheckXidAlive))
     641                 :         998 :         bsysscan = false;
     642                 :             : 
     643                 :     9504329 :     pfree(sysscan);
     644                 :     9504329 : }
     645                 :             : 
     646                 :             : 
     647                 :             : /*
     648                 :             :  * systable_beginscan_ordered --- set up for ordered catalog scan
     649                 :             :  *
     650                 :             :  * These routines have essentially the same API as systable_beginscan etc,
     651                 :             :  * except that they guarantee to return multiple matching tuples in
     652                 :             :  * index order.  Also, for largely historical reasons, the index to use
     653                 :             :  * is opened and locked by the caller, not here.
     654                 :             :  *
     655                 :             :  * Currently we do not support non-index-based scans here.  (In principle
     656                 :             :  * we could do a heapscan and sort, but the uses are in places that
     657                 :             :  * probably don't need to still work with corrupted catalog indexes.)
     658                 :             :  * For the moment, therefore, these functions are merely the thinnest of
     659                 :             :  * wrappers around index_beginscan/table_index_getnext_slot.  The main reason
     660                 :             :  * for their existence is to centralize possible future support of lossy
     661                 :             :  * operators in catalog scans.
     662                 :             :  */
     663                 :             : SysScanDesc
     664                 :       37094 : systable_beginscan_ordered(Relation heapRelation,
     665                 :             :                            Relation indexRelation,
     666                 :             :                            Snapshot snapshot,
     667                 :             :                            int nkeys, ScanKey key)
     668                 :             : {
     669                 :             :     SysScanDesc sysscan;
     670                 :             :     int         i;
     671                 :             :     ScanKey     idxkey;
     672                 :             : 
     673                 :             :     /* REINDEX can probably be a hard error here ... */
     674         [ -  + ]:       37094 :     if (ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))
     675         [ #  # ]:           0 :         ereport(ERROR,
     676                 :             :                 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
     677                 :             :                  errmsg("cannot access index \"%s\" while it is being reindexed",
     678                 :             :                         RelationGetRelationName(indexRelation))));
     679                 :             :     /* ... but we only throw a warning about violating IgnoreSystemIndexes */
     680         [ -  + ]:       37094 :     if (IgnoreSystemIndexes)
     681         [ #  # ]:           0 :         elog(WARNING, "using index \"%s\" despite IgnoreSystemIndexes",
     682                 :             :              RelationGetRelationName(indexRelation));
     683                 :             : 
     684                 :       37094 :     sysscan = palloc_object(SysScanDescData);
     685                 :             : 
     686                 :       37094 :     sysscan->heap_rel = heapRelation;
     687                 :       37094 :     sysscan->irel = indexRelation;
     688                 :       37094 :     sysscan->slot = table_slot_create(heapRelation, NULL);
     689                 :             : 
     690         [ +  + ]:       37094 :     if (snapshot == NULL)
     691                 :             :     {
     692                 :        5410 :         Oid         relid = RelationGetRelid(heapRelation);
     693                 :             : 
     694                 :        5410 :         snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
     695                 :        5410 :         sysscan->snapshot = snapshot;
     696                 :             :     }
     697                 :             :     else
     698                 :             :     {
     699                 :             :         /* Caller is responsible for any snapshot. */
     700                 :       31684 :         sysscan->snapshot = NULL;
     701                 :             :     }
     702                 :             : 
     703                 :       37094 :     idxkey = palloc_array(ScanKeyData, nkeys);
     704                 :             : 
     705                 :             :     /* Convert attribute numbers to be index column numbers. */
     706         [ +  + ]:       72167 :     for (i = 0; i < nkeys; i++)
     707                 :             :     {
     708                 :             :         int         j;
     709                 :             : 
     710                 :       35073 :         memcpy(&idxkey[i], &key[i], sizeof(ScanKeyData));
     711                 :             : 
     712         [ +  - ]:       37192 :         for (j = 0; j < IndexRelationGetNumberOfAttributes(indexRelation); j++)
     713                 :             :         {
     714         [ +  + ]:       37192 :             if (key[i].sk_attno == indexRelation->rd_index->indkey.values[j])
     715                 :             :             {
     716                 :       35073 :                 idxkey[i].sk_attno = j + 1;
     717                 :       35073 :                 break;
     718                 :             :             }
     719                 :             :         }
     720         [ -  + ]:       35073 :         if (j == IndexRelationGetNumberOfAttributes(indexRelation))
     721         [ #  # ]:           0 :             elog(ERROR, "column is not in index");
     722                 :             :     }
     723                 :             : 
     724                 :             :     /*
     725                 :             :      * If CheckXidAlive is set then set a flag to indicate that system table
     726                 :             :      * scan is in-progress.  See detailed comments in xact.c where these
     727                 :             :      * variables are declared.
     728                 :             :      */
     729         [ -  + ]:       37094 :     if (TransactionIdIsValid(CheckXidAlive))
     730                 :           0 :         bsysscan = true;
     731                 :             : 
     732                 :       37094 :     sysscan->iscan = index_beginscan(heapRelation, indexRelation, false,
     733                 :             :                                      snapshot, NULL, nkeys, 0,
     734                 :             :                                      SO_NONE);
     735                 :       37094 :     index_rescan(sysscan->iscan, idxkey, nkeys, NULL, 0);
     736                 :       37094 :     sysscan->scan = NULL;
     737                 :             : 
     738                 :       37094 :     pfree(idxkey);
     739                 :             : 
     740                 :       37094 :     return sysscan;
     741                 :             : }
     742                 :             : 
     743                 :             : /*
     744                 :             :  * systable_getnext_ordered --- get next tuple in an ordered catalog scan
     745                 :             :  */
     746                 :             : HeapTuple
     747                 :      144126 : systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction)
     748                 :             : {
     749                 :      144126 :     HeapTuple   htup = NULL;
     750                 :             : 
     751                 :             :     Assert(sysscan->irel);
     752         [ +  + ]:      144126 :     if (table_index_getnext_slot(sysscan->iscan, direction, sysscan->slot))
     753                 :      107884 :         htup = ExecFetchSlotHeapTuple(sysscan->slot, false, NULL);
     754                 :             : 
     755                 :             :     /* See notes in systable_getnext */
     756   [ +  +  -  + ]:      144123 :     if (htup && sysscan->iscan->xs_recheck)
     757         [ #  # ]:           0 :         elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
     758                 :             : 
     759                 :             :     /*
     760                 :             :      * Handle the concurrent abort while fetching the catalog tuple during
     761                 :             :      * logical streaming of a transaction.
     762                 :             :      */
     763                 :      144123 :     HandleConcurrentAbort();
     764                 :             : 
     765                 :      144123 :     return htup;
     766                 :             : }
     767                 :             : 
     768                 :             : /*
     769                 :             :  * systable_endscan_ordered --- close scan, release resources
     770                 :             :  */
     771                 :             : void
     772                 :       37083 : systable_endscan_ordered(SysScanDesc sysscan)
     773                 :             : {
     774         [ +  - ]:       37083 :     if (sysscan->slot)
     775                 :             :     {
     776                 :       37083 :         ExecDropSingleTupleTableSlot(sysscan->slot);
     777                 :       37083 :         sysscan->slot = NULL;
     778                 :             :     }
     779                 :             : 
     780                 :             :     Assert(sysscan->irel);
     781                 :       37083 :     index_endscan(sysscan->iscan);
     782         [ +  + ]:       37083 :     if (sysscan->snapshot)
     783                 :        5402 :         UnregisterSnapshot(sysscan->snapshot);
     784                 :             : 
     785                 :             :     /*
     786                 :             :      * Reset the bsysscan flag at the end of the systable scan.  See detailed
     787                 :             :      * comments in xact.c where these variables are declared.
     788                 :             :      */
     789         [ -  + ]:       37083 :     if (TransactionIdIsValid(CheckXidAlive))
     790                 :           0 :         bsysscan = false;
     791                 :             : 
     792                 :       37083 :     pfree(sysscan);
     793                 :       37083 : }
     794                 :             : 
     795                 :             : /*
     796                 :             :  * systable_inplace_update_begin --- update a row "in place" (overwrite it)
     797                 :             :  *
     798                 :             :  * Overwriting violates both MVCC and transactional safety, so the uses of
     799                 :             :  * this function in Postgres are extremely limited.  This makes no effort to
     800                 :             :  * support updating cache key columns or other indexed columns.  Nonetheless
     801                 :             :  * we find some places to use it.  See README.tuplock section "Locking to
     802                 :             :  * write inplace-updated tables" and later sections for expectations of
     803                 :             :  * readers and writers of a table that gets inplace updates.  Standard flow:
     804                 :             :  *
     805                 :             :  * ... [any slow preparation not requiring oldtup] ...
     806                 :             :  * systable_inplace_update_begin([...], &tup, &inplace_state);
     807                 :             :  * if (!HeapTupleIsValid(tup))
     808                 :             :  *  elog(ERROR, [...]);
     809                 :             :  * ... [buffer is exclusive-locked; mutate "tup"] ...
     810                 :             :  * if (dirty)
     811                 :             :  *  systable_inplace_update_finish(inplace_state, tup);
     812                 :             :  * else
     813                 :             :  *  systable_inplace_update_cancel(inplace_state);
     814                 :             :  *
     815                 :             :  * The first several params duplicate the systable_beginscan() param list.
     816                 :             :  * "oldtupcopy" is an output parameter, assigned NULL if the key ceases to
     817                 :             :  * find a live tuple.  (In PROC_IN_VACUUM, that is a low-probability transient
     818                 :             :  * condition.)  If "oldtupcopy" gets non-NULL, you must pass output parameter
     819                 :             :  * "state" to systable_inplace_update_finish() or
     820                 :             :  * systable_inplace_update_cancel().
     821                 :             :  */
     822                 :             : void
     823                 :      223683 : systable_inplace_update_begin(Relation relation,
     824                 :             :                               Oid indexId,
     825                 :             :                               bool indexOK,
     826                 :             :                               Snapshot snapshot,
     827                 :             :                               int nkeys, const ScanKeyData *key,
     828                 :             :                               HeapTuple *oldtupcopy,
     829                 :             :                               void **state)
     830                 :             : {
     831                 :      223683 :     int         retries = 0;
     832                 :             :     SysScanDesc scan;
     833                 :             :     HeapTuple   oldtup;
     834                 :             :     BufferHeapTupleTableSlot *bslot;
     835                 :             : 
     836                 :             :     /*
     837                 :             :      * For now, we don't allow parallel updates.  Unlike a regular update,
     838                 :             :      * this should never create a combo CID, so it might be possible to relax
     839                 :             :      * this restriction, but not without more thought and testing.  It's not
     840                 :             :      * clear that it would be useful, anyway.
     841                 :             :      */
     842         [ -  + ]:      223683 :     if (IsInParallelMode())
     843         [ #  # ]:           0 :         ereport(ERROR,
     844                 :             :                 (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
     845                 :             :                  errmsg("cannot update tuples during a parallel operation")));
     846                 :             : 
     847                 :             :     /*
     848                 :             :      * Accept a snapshot argument, for symmetry, but this function advances
     849                 :             :      * its snapshot as needed to reach the tail of the updated tuple chain.
     850                 :             :      */
     851                 :             :     Assert(snapshot == NULL);
     852                 :             : 
     853                 :             :     Assert(IsInplaceUpdateRelation(relation) || !IsSystemRelation(relation));
     854                 :             : 
     855                 :             :     /* Loop for an exclusive-locked buffer of a non-updated tuple. */
     856                 :             :     do
     857                 :             :     {
     858                 :             :         TupleTableSlot *slot;
     859                 :             : 
     860         [ +  + ]:      223702 :         CHECK_FOR_INTERRUPTS();
     861                 :             : 
     862                 :             :         /*
     863                 :             :          * Processes issuing heap_update (e.g. GRANT) at maximum speed could
     864                 :             :          * drive us to this error.  A hostile table owner has stronger ways to
     865                 :             :          * damage their own table, so that's minor.
     866                 :             :          */
     867         [ -  + ]:      223701 :         if (retries++ > 10000)
     868         [ #  # ]:           0 :             elog(ERROR, "giving up after too many tries to overwrite row");
     869                 :             : 
     870                 :      223701 :         INJECTION_POINT("inplace-before-pin", NULL);
     871                 :      223701 :         scan = systable_beginscan(relation, indexId, indexOK, snapshot,
     872                 :             :                                   nkeys, unconstify(ScanKeyData *, key));
     873                 :      223701 :         oldtup = systable_getnext(scan);
     874         [ -  + ]:      223701 :         if (!HeapTupleIsValid(oldtup))
     875                 :             :         {
     876                 :           0 :             systable_endscan(scan);
     877                 :           0 :             *oldtupcopy = NULL;
     878                 :           0 :             return;
     879                 :             :         }
     880                 :             : 
     881                 :      223701 :         slot = scan->slot;
     882                 :             :         Assert(TTS_IS_BUFFERTUPLE(slot));
     883                 :      223701 :         bslot = (BufferHeapTupleTableSlot *) slot;
     884         [ +  + ]:      223701 :     } while (!heap_inplace_lock(scan->heap_rel,
     885                 :             :                                 bslot->base.tuple, bslot->buffer,
     886                 :             :                                 (void (*) (void *)) systable_endscan, scan));
     887                 :             : 
     888                 :      223682 :     *oldtupcopy = heap_copytuple(oldtup);
     889                 :      223682 :     *state = scan;
     890                 :             : }
     891                 :             : 
     892                 :             : /*
     893                 :             :  * systable_inplace_update_finish --- second phase of inplace update
     894                 :             :  *
     895                 :             :  * The tuple cannot change size, and therefore its header fields and null
     896                 :             :  * bitmap (if any) don't change either.
     897                 :             :  */
     898                 :             : void
     899                 :       97238 : systable_inplace_update_finish(void *state, HeapTuple tuple)
     900                 :             : {
     901                 :       97238 :     SysScanDesc scan = (SysScanDesc) state;
     902                 :       97238 :     Relation    relation = scan->heap_rel;
     903                 :       97238 :     TupleTableSlot *slot = scan->slot;
     904                 :       97238 :     BufferHeapTupleTableSlot *bslot = (BufferHeapTupleTableSlot *) slot;
     905                 :       97238 :     HeapTuple   oldtup = bslot->base.tuple;
     906                 :       97238 :     Buffer      buffer = bslot->buffer;
     907                 :             : 
     908                 :       97238 :     heap_inplace_update_and_unlock(relation, oldtup, tuple, buffer);
     909                 :       97238 :     systable_endscan(scan);
     910                 :       97238 : }
     911                 :             : 
     912                 :             : /*
     913                 :             :  * systable_inplace_update_cancel --- abandon inplace update
     914                 :             :  *
     915                 :             :  * This is an alternative to making a no-op update.
     916                 :             :  */
     917                 :             : void
     918                 :      126444 : systable_inplace_update_cancel(void *state)
     919                 :             : {
     920                 :      126444 :     SysScanDesc scan = (SysScanDesc) state;
     921                 :      126444 :     Relation    relation = scan->heap_rel;
     922                 :      126444 :     TupleTableSlot *slot = scan->slot;
     923                 :      126444 :     BufferHeapTupleTableSlot *bslot = (BufferHeapTupleTableSlot *) slot;
     924                 :      126444 :     HeapTuple   oldtup = bslot->base.tuple;
     925                 :      126444 :     Buffer      buffer = bslot->buffer;
     926                 :             : 
     927                 :      126444 :     heap_inplace_unlock(relation, oldtup, buffer);
     928                 :      126444 :     systable_endscan(scan);
     929                 :      126444 : }
        

Generated by: LCOV version 2.0-1