MCPcopy Create free account
hub / github.com/apache/cloudberry / tuple_to_stringinfo

Function tuple_to_stringinfo

contrib/test_decoding/test_decoding.c:517–588  ·  view source on GitHub ↗

print the tuple 'tuple' into the StringInfo s */

Source from the content-addressed store, hash-verified

515
516/* print the tuple 'tuple' into the StringInfo s */
517static void
518tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
519{
520 int natt;
521
522 /* print all columns individually */
523 for (natt = 0; natt < tupdesc->natts; natt++)
524 {
525 Form_pg_attribute attr; /* the attribute itself */
526 Oid typid; /* type of current attribute */
527 Oid typoutput; /* output function */
528 bool typisvarlena;
529 Datum origval; /* possibly toasted Datum */
530 bool isnull; /* column is null? */
531
532 attr = TupleDescAttr(tupdesc, natt);
533
534 /*
535 * don't print dropped columns, we can't be sure everything is
536 * available for them
537 */
538 if (attr->attisdropped)
539 continue;
540
541 /*
542 * Don't print system columns, oid will already have been printed if
543 * present.
544 */
545 if (attr->attnum < 0)
546 continue;
547
548 typid = attr->atttypid;
549
550 /* get Datum from tuple */
551 origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
552
553 if (isnull && skip_nulls)
554 continue;
555
556 /* print attribute name */
557 appendStringInfoChar(s, ' ');
558 appendStringInfoString(s, quote_identifier(NameStr(attr->attname)));
559
560 /* print attribute type */
561 appendStringInfoChar(s, '[');
562 appendStringInfoString(s, format_type_be(typid));
563 appendStringInfoChar(s, ']');
564
565 /* query output function */
566 getTypeOutputInfo(typid,
567 &typoutput, &typisvarlena);
568
569 /* print separator */
570 appendStringInfoChar(s, ':');
571
572 /* print data */
573 if (isnull)
574 appendStringInfoString(s, "null");

Callers 1

pg_decode_changeFunction · 0.85

Calls 8

heap_getattrFunction · 0.85
appendStringInfoCharFunction · 0.85
appendStringInfoStringFunction · 0.85
format_type_beFunction · 0.85
getTypeOutputInfoFunction · 0.85
print_literalFunction · 0.85
OidOutputFunctionCallFunction · 0.85
quote_identifierFunction · 0.50

Tested by

no test coverage detected