LCOV - code coverage report
Current view: top level - src/backend/access/common - printtup.c (source / functions) Coverage Total Hit
Test: Code coverage Lines: 92.0 % 187 172
Test Date: 2026-01-26 10:56:24 Functions: 100.0 % 11 11
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 74.6 % 63 47

             Branch data     Line data    Source code
       1                 :             : /*-------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * printtup.c
       4                 :             :  *        Routines to print out tuples to the destination (both frontend
       5                 :             :  *        clients and standalone backends are supported here).
       6                 :             :  *
       7                 :             :  *
       8                 :             :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
       9                 :             :  * Portions Copyright (c) 1994, Regents of the University of California
      10                 :             :  *
      11                 :             :  * IDENTIFICATION
      12                 :             :  *        src/backend/access/common/printtup.c
      13                 :             :  *
      14                 :             :  *-------------------------------------------------------------------------
      15                 :             :  */
      16                 :             : #include "postgres.h"
      17                 :             : 
      18                 :             : #include "access/printtup.h"
      19                 :             : #include "libpq/pqformat.h"
      20                 :             : #include "libpq/protocol.h"
      21                 :             : #include "tcop/pquery.h"
      22                 :             : #include "utils/lsyscache.h"
      23                 :             : #include "utils/memdebug.h"
      24                 :             : #include "utils/memutils.h"
      25                 :             : #include "varatt.h"
      26                 :             : 
      27                 :             : 
      28                 :             : static void printtup_startup(DestReceiver *self, int operation,
      29                 :             :                                                          TupleDesc typeinfo);
      30                 :             : static bool printtup(TupleTableSlot *slot, DestReceiver *self);
      31                 :             : static void printtup_shutdown(DestReceiver *self);
      32                 :             : static void printtup_destroy(DestReceiver *self);
      33                 :             : 
      34                 :             : /* ----------------------------------------------------------------
      35                 :             :  *              printtup / debugtup support
      36                 :             :  * ----------------------------------------------------------------
      37                 :             :  */
      38                 :             : 
      39                 :             : /* ----------------
      40                 :             :  *              Private state for a printtup destination object
      41                 :             :  *
      42                 :             :  * NOTE: finfo is the lookup info for either typoutput or typsend, whichever
      43                 :             :  * we are using for this column.
      44                 :             :  * ----------------
      45                 :             :  */
      46                 :             : typedef struct
      47                 :             : {                                                               /* Per-attribute information */
      48                 :             :         Oid                     typoutput;              /* Oid for the type's text output fn */
      49                 :             :         Oid                     typsend;                /* Oid for the type's binary output fn */
      50                 :             :         bool            typisvarlena;   /* is it varlena (ie possibly toastable)? */
      51                 :             :         int16           format;                 /* format code for this column */
      52                 :             :         FmgrInfo        finfo;                  /* Precomputed call info for output fn */
      53                 :             : } PrinttupAttrInfo;
      54                 :             : 
      55                 :             : typedef struct
      56                 :             : {
      57                 :             :         DestReceiver pub;                       /* publicly-known function pointers */
      58                 :             :         Portal          portal;                 /* the Portal we are printing from */
      59                 :             :         bool            sendDescrip;    /* send RowDescription at startup? */
      60                 :             :         TupleDesc       attrinfo;               /* The attr info we are set up for */
      61                 :             :         int                     nattrs;
      62                 :             :         PrinttupAttrInfo *myinfo;       /* Cached info about each attr */
      63                 :             :         StringInfoData buf;                     /* output buffer (*not* in tmpcontext) */
      64                 :             :         MemoryContext tmpcontext;       /* Memory context for per-row workspace */
      65                 :             : } DR_printtup;
      66                 :             : 
      67                 :             : /* ----------------
      68                 :             :  *              Initialize: create a DestReceiver for printtup
      69                 :             :  * ----------------
      70                 :             :  */
      71                 :             : DestReceiver *
      72                 :       55672 : printtup_create_DR(CommandDest dest)
      73                 :             : {
      74                 :       55672 :         DR_printtup *self = palloc0_object(DR_printtup);
      75                 :             : 
      76                 :       55672 :         self->pub.receiveSlot = printtup;    /* might get changed later */
      77                 :       55672 :         self->pub.rStartup = printtup_startup;
      78                 :       55672 :         self->pub.rShutdown = printtup_shutdown;
      79                 :       55672 :         self->pub.rDestroy = printtup_destroy;
      80                 :       55672 :         self->pub.mydest = dest;
      81                 :             : 
      82                 :             :         /*
      83                 :             :          * Send T message automatically if DestRemote, but not if
      84                 :             :          * DestRemoteExecute
      85                 :             :          */
      86                 :       55672 :         self->sendDescrip = (dest == DestRemote);
      87                 :             : 
      88                 :       55672 :         self->attrinfo = NULL;
      89                 :       55672 :         self->nattrs = 0;
      90                 :       55672 :         self->myinfo = NULL;
      91                 :       55672 :         self->buf.data = NULL;
      92                 :       55672 :         self->tmpcontext = NULL;
      93                 :             : 
      94                 :      111344 :         return (DestReceiver *) self;
      95                 :       55672 : }
      96                 :             : 
      97                 :             : /*
      98                 :             :  * Set parameters for a DestRemote (or DestRemoteExecute) receiver
      99                 :             :  */
     100                 :             : void
     101                 :       55672 : SetRemoteDestReceiverParams(DestReceiver *self, Portal portal)
     102                 :             : {
     103                 :       55672 :         DR_printtup *myState = (DR_printtup *) self;
     104                 :             : 
     105   [ +  +  +  - ]:       55672 :         Assert(myState->pub.mydest == DestRemote ||
     106                 :             :                    myState->pub.mydest == DestRemoteExecute);
     107                 :             : 
     108                 :       55672 :         myState->portal = portal;
     109                 :       55672 : }
     110                 :             : 
     111                 :             : static void
     112                 :       26799 : printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
     113                 :             : {
     114                 :       26799 :         DR_printtup *myState = (DR_printtup *) self;
     115                 :       26799 :         Portal          portal = myState->portal;
     116                 :             : 
     117                 :             :         /*
     118                 :             :          * Create I/O buffer to be used for all messages.  This cannot be inside
     119                 :             :          * tmpcontext, since we want to re-use it across rows.
     120                 :             :          */
     121                 :       26799 :         initStringInfo(&myState->buf);
     122                 :             : 
     123                 :             :         /*
     124                 :             :          * Create a temporary memory context that we can reset once per row to
     125                 :             :          * recover palloc'd memory.  This avoids any problems with leaks inside
     126                 :             :          * datatype output routines, and should be faster than retail pfree's
     127                 :             :          * anyway.
     128                 :             :          */
     129                 :       26799 :         myState->tmpcontext = AllocSetContextCreate(CurrentMemoryContext,
     130                 :             :                                                                                                 "printtup",
     131                 :             :                                                                                                 ALLOCSET_DEFAULT_SIZES);
     132                 :             : 
     133                 :             :         /*
     134                 :             :          * If we are supposed to emit row descriptions, then send the tuple
     135                 :             :          * descriptor of the tuples.
     136                 :             :          */
     137         [ +  + ]:       26799 :         if (myState->sendDescrip)
     138                 :       53446 :                 SendRowDescriptionMessage(&myState->buf,
     139                 :       26723 :                                                                   typeinfo,
     140                 :       26723 :                                                                   FetchPortalTargetList(portal),
     141                 :       26723 :                                                                   portal->formats);
     142                 :             : 
     143                 :             :         /* ----------------
     144                 :             :          * We could set up the derived attr info at this time, but we postpone it
     145                 :             :          * until the first call of printtup, for 2 reasons:
     146                 :             :          * 1. We don't waste time (compared to the old way) if there are no
     147                 :             :          *        tuples at all to output.
     148                 :             :          * 2. Checking in printtup allows us to handle the case that the tuples
     149                 :             :          *        change type midway through (although this probably can't happen in
     150                 :             :          *        the current executor).
     151                 :             :          * ----------------
     152                 :             :          */
     153                 :       26799 : }
     154                 :             : 
     155                 :             : /*
     156                 :             :  * SendRowDescriptionMessage --- send a RowDescription message to the frontend
     157                 :             :  *
     158                 :             :  * Notes: the TupleDesc has typically been manufactured by ExecTypeFromTL()
     159                 :             :  * or some similar function; it does not contain a full set of fields.
     160                 :             :  * The targetlist will be NIL when executing a utility function that does
     161                 :             :  * not have a plan.  If the targetlist isn't NIL then it is a Query node's
     162                 :             :  * targetlist; it is up to us to ignore resjunk columns in it.  The formats[]
     163                 :             :  * array pointer might be NULL (if we are doing Describe on a prepared stmt);
     164                 :             :  * send zeroes for the format codes in that case.
     165                 :             :  */
     166                 :             : void
     167                 :       26806 : SendRowDescriptionMessage(StringInfo buf, TupleDesc typeinfo,
     168                 :             :                                                   List *targetlist, int16 *formats)
     169                 :             : {
     170                 :       26806 :         int                     natts = typeinfo->natts;
     171                 :       26806 :         int                     i;
     172                 :       26806 :         ListCell   *tlist_item = list_head(targetlist);
     173                 :             : 
     174                 :             :         /* tuple descriptor message type */
     175                 :       26806 :         pq_beginmessage_reuse(buf, PqMsg_RowDescription);
     176                 :             :         /* # of attrs in tuples */
     177                 :       26806 :         pq_sendint16(buf, natts);
     178                 :             : 
     179                 :             :         /*
     180                 :             :          * Preallocate memory for the entire message to be sent. That allows to
     181                 :             :          * use the significantly faster inline pqformat.h functions and to avoid
     182                 :             :          * reallocations.
     183                 :             :          *
     184                 :             :          * Have to overestimate the size of the column-names, to account for
     185                 :             :          * character set overhead.
     186                 :             :          */
     187                 :       53612 :         enlargeStringInfo(buf, (NAMEDATALEN * MAX_CONVERSION_GROWTH /* attname */
     188                 :             :                                                         + sizeof(Oid)   /* resorigtbl */
     189                 :             :                                                         + sizeof(AttrNumber)    /* resorigcol */
     190                 :             :                                                         + sizeof(Oid)   /* atttypid */
     191                 :             :                                                         + sizeof(int16) /* attlen */
     192                 :             :                                                         + sizeof(int32) /* attypmod */
     193                 :             :                                                         + sizeof(int16) /* format */
     194                 :       26806 :                                                         ) * natts);
     195                 :             : 
     196         [ +  + ]:      102005 :         for (i = 0; i < natts; ++i)
     197                 :             :         {
     198                 :       75199 :                 Form_pg_attribute att = TupleDescAttr(typeinfo, i);
     199                 :       75199 :                 Oid                     atttypid = att->atttypid;
     200                 :       75199 :                 int32           atttypmod = att->atttypmod;
     201                 :       75199 :                 Oid                     resorigtbl;
     202                 :       75199 :                 AttrNumber      resorigcol;
     203                 :       75199 :                 int16           format;
     204                 :             : 
     205                 :             :                 /*
     206                 :             :                  * If column is a domain, send the base type and typmod instead.
     207                 :             :                  * Lookup before sending any ints, for efficiency.
     208                 :             :                  */
     209                 :       75199 :                 atttypid = getBaseTypeAndTypmod(atttypid, &atttypmod);
     210                 :             : 
     211                 :             :                 /* Do we have a non-resjunk tlist item? */
     212   [ +  +  -  + ]:      147986 :                 while (tlist_item &&
     213                 :       72787 :                            ((TargetEntry *) lfirst(tlist_item))->resjunk)
     214                 :           0 :                         tlist_item = lnext(targetlist, tlist_item);
     215         [ +  + ]:       75199 :                 if (tlist_item)
     216                 :             :                 {
     217                 :       72787 :                         TargetEntry *tle = (TargetEntry *) lfirst(tlist_item);
     218                 :             : 
     219                 :       72787 :                         resorigtbl = tle->resorigtbl;
     220                 :       72787 :                         resorigcol = tle->resorigcol;
     221                 :       72787 :                         tlist_item = lnext(targetlist, tlist_item);
     222                 :       72787 :                 }
     223                 :             :                 else
     224                 :             :                 {
     225                 :             :                         /* No info available, so send zeroes */
     226                 :        2412 :                         resorigtbl = 0;
     227                 :        2412 :                         resorigcol = 0;
     228                 :             :                 }
     229                 :             : 
     230         [ +  + ]:       75199 :                 if (formats)
     231                 :       75158 :                         format = formats[i];
     232                 :             :                 else
     233                 :          41 :                         format = 0;
     234                 :             : 
     235                 :       75199 :                 pq_writestring(buf, NameStr(att->attname));
     236                 :       75199 :                 pq_writeint32(buf, resorigtbl);
     237                 :       75199 :                 pq_writeint16(buf, resorigcol);
     238                 :       75199 :                 pq_writeint32(buf, atttypid);
     239                 :       75199 :                 pq_writeint16(buf, att->attlen);
     240                 :       75199 :                 pq_writeint32(buf, atttypmod);
     241                 :       75199 :                 pq_writeint16(buf, format);
     242                 :       75199 :         }
     243                 :             : 
     244                 :       26806 :         pq_endmessage_reuse(buf);
     245                 :       26806 : }
     246                 :             : 
     247                 :             : /*
     248                 :             :  * Get the lookup info that printtup() needs
     249                 :             :  */
     250                 :             : static void
     251                 :       21494 : printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs)
     252                 :             : {
     253                 :       21494 :         int16      *formats = myState->portal->formats;
     254                 :       21494 :         int                     i;
     255                 :             : 
     256                 :             :         /* get rid of any old data */
     257         [ +  + ]:       21494 :         if (myState->myinfo)
     258                 :         178 :                 pfree(myState->myinfo);
     259                 :       21494 :         myState->myinfo = NULL;
     260                 :             : 
     261                 :       21494 :         myState->attrinfo = typeinfo;
     262                 :       21494 :         myState->nattrs = numAttrs;
     263         [ +  + ]:       21494 :         if (numAttrs <= 0)
     264                 :          20 :                 return;
     265                 :             : 
     266                 :       21474 :         myState->myinfo = (PrinttupAttrInfo *)
     267                 :       21474 :                 palloc0(numAttrs * sizeof(PrinttupAttrInfo));
     268                 :             : 
     269         [ +  + ]:       77857 :         for (i = 0; i < numAttrs; i++)
     270                 :             :         {
     271                 :       56383 :                 PrinttupAttrInfo *thisState = myState->myinfo + i;
     272         [ +  + ]:       56383 :                 int16           format = (formats ? formats[i] : 0);
     273                 :       56383 :                 Form_pg_attribute attr = TupleDescAttr(typeinfo, i);
     274                 :             : 
     275                 :       56383 :                 thisState->format = format;
     276         [ -  + ]:       56383 :                 if (format == 0)
     277                 :             :                 {
     278                 :      112766 :                         getTypeOutputInfo(attr->atttypid,
     279                 :       56383 :                                                           &thisState->typoutput,
     280                 :       56383 :                                                           &thisState->typisvarlena);
     281                 :       56383 :                         fmgr_info(thisState->typoutput, &thisState->finfo);
     282                 :       56383 :                 }
     283         [ #  # ]:           0 :                 else if (format == 1)
     284                 :             :                 {
     285                 :           0 :                         getTypeBinaryOutputInfo(attr->atttypid,
     286                 :           0 :                                                                         &thisState->typsend,
     287                 :           0 :                                                                         &thisState->typisvarlena);
     288                 :           0 :                         fmgr_info(thisState->typsend, &thisState->finfo);
     289                 :           0 :                 }
     290                 :             :                 else
     291   [ #  #  #  # ]:           0 :                         ereport(ERROR,
     292                 :             :                                         (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
     293                 :             :                                          errmsg("unsupported format code: %d", format)));
     294                 :       56383 :         }
     295         [ -  + ]:       21494 : }
     296                 :             : 
     297                 :             : /* ----------------
     298                 :             :  *              printtup --- send a tuple to the client
     299                 :             :  *
     300                 :             :  * Note: if you change this function, see also serializeAnalyzeReceive
     301                 :             :  * in explain.c, which is meant to replicate the computations done here.
     302                 :             :  * ----------------
     303                 :             :  */
     304                 :             : static bool
     305                 :       79839 : printtup(TupleTableSlot *slot, DestReceiver *self)
     306                 :             : {
     307                 :       79839 :         TupleDesc       typeinfo = slot->tts_tupleDescriptor;
     308                 :       79839 :         DR_printtup *myState = (DR_printtup *) self;
     309                 :       79839 :         MemoryContext oldcontext;
     310                 :       79839 :         StringInfo      buf = &myState->buf;
     311                 :       79839 :         int                     natts = typeinfo->natts;
     312                 :       79839 :         int                     i;
     313                 :             : 
     314                 :             :         /* Set or update my derived attribute info, if needed */
     315   [ +  +  -  + ]:       79839 :         if (myState->attrinfo != typeinfo || myState->nattrs != natts)
     316                 :       21494 :                 printtup_prepare_info(myState, typeinfo, natts);
     317                 :             : 
     318                 :             :         /* Make sure the tuple is fully deconstructed */
     319                 :       79839 :         slot_getallattrs(slot);
     320                 :             : 
     321                 :             :         /* Switch into per-row context so we can recover memory below */
     322                 :       79839 :         oldcontext = MemoryContextSwitchTo(myState->tmpcontext);
     323                 :             : 
     324                 :             :         /*
     325                 :             :          * Prepare a DataRow message (note buffer is in per-query context)
     326                 :             :          */
     327                 :       79839 :         pq_beginmessage_reuse(buf, PqMsg_DataRow);
     328                 :             : 
     329                 :       79839 :         pq_sendint16(buf, natts);
     330                 :             : 
     331                 :             :         /*
     332                 :             :          * send the attributes of this tuple
     333                 :             :          */
     334         [ +  + ]:      285236 :         for (i = 0; i < natts; ++i)
     335                 :             :         {
     336                 :      205397 :                 PrinttupAttrInfo *thisState = myState->myinfo + i;
     337                 :      205397 :                 Datum           attr = slot->tts_values[i];
     338                 :             : 
     339         [ +  + ]:      205397 :                 if (slot->tts_isnull[i])
     340                 :             :                 {
     341                 :       14114 :                         pq_sendint32(buf, -1);
     342                 :       14114 :                         continue;
     343                 :             :                 }
     344                 :             : 
     345                 :             :                 /*
     346                 :             :                  * Here we catch undefined bytes in datums that are returned to the
     347                 :             :                  * client without hitting disk; see comments at the related check in
     348                 :             :                  * PageAddItem().  This test is most useful for uncompressed,
     349                 :             :                  * non-external datums, but we're quite likely to see such here when
     350                 :             :                  * testing new C functions.
     351                 :             :                  */
     352         [ +  + ]:      191283 :                 if (thisState->typisvarlena)
     353                 :       64117 :                         VALGRIND_CHECK_MEM_IS_DEFINED(DatumGetPointer(attr),
     354                 :             :                                                                                   VARSIZE_ANY(DatumGetPointer(attr)));
     355                 :             : 
     356         [ -  + ]:      191283 :                 if (thisState->format == 0)
     357                 :             :                 {
     358                 :             :                         /* Text output */
     359                 :      191283 :                         char       *outputstr;
     360                 :             : 
     361                 :      191283 :                         outputstr = OutputFunctionCall(&thisState->finfo, attr);
     362                 :      191283 :                         pq_sendcountedtext(buf, outputstr, strlen(outputstr));
     363                 :      191283 :                 }
     364                 :             :                 else
     365                 :             :                 {
     366                 :             :                         /* Binary output */
     367                 :           0 :                         bytea      *outputbytes;
     368                 :             : 
     369                 :           0 :                         outputbytes = SendFunctionCall(&thisState->finfo, attr);
     370                 :           0 :                         pq_sendint32(buf, VARSIZE(outputbytes) - VARHDRSZ);
     371                 :           0 :                         pq_sendbytes(buf, VARDATA(outputbytes),
     372                 :           0 :                                                  VARSIZE(outputbytes) - VARHDRSZ);
     373                 :           0 :                 }
     374      [ -  +  + ]:      205397 :         }
     375                 :             : 
     376                 :       79839 :         pq_endmessage_reuse(buf);
     377                 :             : 
     378                 :             :         /* Return to caller's context, and flush row's temporary memory */
     379                 :       79839 :         MemoryContextSwitchTo(oldcontext);
     380                 :       79839 :         MemoryContextReset(myState->tmpcontext);
     381                 :             : 
     382                 :       79839 :         return true;
     383                 :       79839 : }
     384                 :             : 
     385                 :             : /* ----------------
     386                 :             :  *              printtup_shutdown
     387                 :             :  * ----------------
     388                 :             :  */
     389                 :             : static void
     390                 :       25857 : printtup_shutdown(DestReceiver *self)
     391                 :             : {
     392                 :       25857 :         DR_printtup *myState = (DR_printtup *) self;
     393                 :             : 
     394         [ +  + ]:       25857 :         if (myState->myinfo)
     395                 :       21270 :                 pfree(myState->myinfo);
     396                 :       25857 :         myState->myinfo = NULL;
     397                 :             : 
     398                 :       25857 :         myState->attrinfo = NULL;
     399                 :             : 
     400         [ -  + ]:       25857 :         if (myState->buf.data)
     401                 :       25857 :                 pfree(myState->buf.data);
     402                 :       25857 :         myState->buf.data = NULL;
     403                 :             : 
     404         [ -  + ]:       25857 :         if (myState->tmpcontext)
     405                 :       25857 :                 MemoryContextDelete(myState->tmpcontext);
     406                 :       25857 :         myState->tmpcontext = NULL;
     407                 :       25857 : }
     408                 :             : 
     409                 :             : /* ----------------
     410                 :             :  *              printtup_destroy
     411                 :             :  * ----------------
     412                 :             :  */
     413                 :             : static void
     414                 :       51413 : printtup_destroy(DestReceiver *self)
     415                 :             : {
     416                 :       51413 :         pfree(self);
     417                 :       51413 : }
     418                 :             : 
     419                 :             : /* ----------------
     420                 :             :  *              printatt
     421                 :             :  * ----------------
     422                 :             :  */
     423                 :             : static void
     424                 :           4 : printatt(unsigned attributeId,
     425                 :             :                  Form_pg_attribute attributeP,
     426                 :             :                  char *value)
     427                 :             : {
     428         [ +  + ]:           4 :         printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
     429                 :             :                    attributeId,
     430                 :             :                    NameStr(attributeP->attname),
     431                 :             :                    value != NULL ? " = \"" : "",
     432                 :             :                    value != NULL ? value : "",
     433                 :             :                    value != NULL ? "\"" : "",
     434                 :             :                    attributeP->atttypid,
     435                 :             :                    attributeP->attlen,
     436                 :             :                    attributeP->atttypmod,
     437                 :             :                    attributeP->attbyval ? 't' : 'f');
     438                 :           4 : }
     439                 :             : 
     440                 :             : /* ----------------
     441                 :             :  *              debugStartup - prepare to print tuples for an interactive backend
     442                 :             :  * ----------------
     443                 :             :  */
     444                 :             : void
     445                 :           2 : debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo)
     446                 :             : {
     447                 :           2 :         int                     natts = typeinfo->natts;
     448                 :           2 :         int                     i;
     449                 :             : 
     450                 :             :         /*
     451                 :             :          * show the return type of the tuples
     452                 :             :          */
     453         [ +  + ]:           4 :         for (i = 0; i < natts; ++i)
     454                 :           2 :                 printatt((unsigned) i + 1, TupleDescAttr(typeinfo, i), NULL);
     455                 :           2 :         printf("\t----\n");
     456                 :           2 : }
     457                 :             : 
     458                 :             : /* ----------------
     459                 :             :  *              debugtup - print one tuple for an interactive backend
     460                 :             :  * ----------------
     461                 :             :  */
     462                 :             : bool
     463                 :           2 : debugtup(TupleTableSlot *slot, DestReceiver *self)
     464                 :             : {
     465                 :           2 :         TupleDesc       typeinfo = slot->tts_tupleDescriptor;
     466                 :           2 :         int                     natts = typeinfo->natts;
     467                 :           2 :         int                     i;
     468                 :           2 :         Datum           attr;
     469                 :           2 :         char       *value;
     470                 :           2 :         bool            isnull;
     471                 :           2 :         Oid                     typoutput;
     472                 :           2 :         bool            typisvarlena;
     473                 :             : 
     474         [ +  + ]:           4 :         for (i = 0; i < natts; ++i)
     475                 :             :         {
     476                 :           2 :                 attr = slot_getattr(slot, i + 1, &isnull);
     477         [ -  + ]:           2 :                 if (isnull)
     478                 :           0 :                         continue;
     479                 :           2 :                 getTypeOutputInfo(TupleDescAttr(typeinfo, i)->atttypid,
     480                 :             :                                                   &typoutput, &typisvarlena);
     481                 :             : 
     482                 :           2 :                 value = OidOutputFunctionCall(typoutput, attr);
     483                 :             : 
     484                 :           2 :                 printatt((unsigned) i + 1, TupleDescAttr(typeinfo, i), value);
     485                 :           2 :         }
     486                 :           2 :         printf("\t----\n");
     487                 :             : 
     488                 :           2 :         return true;
     489                 :           2 : }
        

Generated by: LCOV version 2.3.2-1