LCOV - differential code coverage report
Current view: top level - src/backend/nodes - outfuncs.c (source / functions) Coverage Total Hit LBC UBC GBC CBC EUB
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 55.5 % 371 206 165 206
Current Date: 2025-09-06 07:49:51 +0900 Functions: 56.7 % 30 17 13 17
Baseline: lcov-20250906-005545-baseline Branches: 36.4 % 588 214 12 362 12 202 1
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 0.0 % 5 0 5
(360..) days: 56.3 % 366 206 160 206
Function coverage date bins:
(360..) days: 56.7 % 30 17 13 17
Branch coverage date bins:
(30,360] days: 0.0 % 4 0 4
(360..) days: 36.6 % 585 214 12 358 12 202 1

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * outfuncs.c
                                  4                 :                :  *    Output functions for Postgres tree nodes.
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/backend/nodes/outfuncs.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : #include "postgres.h"
                                 16                 :                : 
                                 17                 :                : #include <ctype.h>
                                 18                 :                : 
                                 19                 :                : #include "access/attnum.h"
                                 20                 :                : #include "common/shortest_dec.h"
                                 21                 :                : #include "lib/stringinfo.h"
                                 22                 :                : #include "miscadmin.h"
                                 23                 :                : #include "nodes/bitmapset.h"
                                 24                 :                : #include "nodes/nodes.h"
                                 25                 :                : #include "nodes/pg_list.h"
                                 26                 :                : #include "utils/datum.h"
                                 27                 :                : 
                                 28                 :                : /* State flag that determines how nodeToStringInternal() should treat location fields */
                                 29                 :                : static bool write_location_fields = false;
                                 30                 :                : 
                                 31                 :                : static void outChar(StringInfo str, char c);
                                 32                 :                : static void outDouble(StringInfo str, double d);
                                 33                 :                : 
                                 34                 :                : 
                                 35                 :                : /*
                                 36                 :                :  * Macros to simplify output of different kinds of fields.  Use these
                                 37                 :                :  * wherever possible to reduce the chance for silly typos.  Note that these
                                 38                 :                :  * hard-wire conventions about the names of the local variables in an Out
                                 39                 :                :  * routine.
                                 40                 :                :  */
                                 41                 :                : 
                                 42                 :                : /* Write the label for the node type */
                                 43                 :                : #define WRITE_NODE_TYPE(nodelabel) \
                                 44                 :                :     appendStringInfoString(str, nodelabel)
                                 45                 :                : 
                                 46                 :                : /* Write an integer field (anything written as ":fldname %d") */
                                 47                 :                : #define WRITE_INT_FIELD(fldname) \
                                 48                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
                                 49                 :                : 
                                 50                 :                : /* Write an unsigned integer field (anything written as ":fldname %u") */
                                 51                 :                : #define WRITE_UINT_FIELD(fldname) \
                                 52                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
                                 53                 :                : 
                                 54                 :                : /* Write a signed integer field (anything written with INT64_FORMAT) */
                                 55                 :                : #define WRITE_INT64_FIELD(fldname) \
                                 56                 :                :     appendStringInfo(str, \
                                 57                 :                :                      " :" CppAsString(fldname) " " INT64_FORMAT, \
                                 58                 :                :                      node->fldname)
                                 59                 :                : 
                                 60                 :                : /* Write an unsigned integer field (anything written with UINT64_FORMAT) */
                                 61                 :                : #define WRITE_UINT64_FIELD(fldname) \
                                 62                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " " UINT64_FORMAT, \
                                 63                 :                :                      node->fldname)
                                 64                 :                : 
                                 65                 :                : /* Write an OID field (don't hard-wire assumption that OID is same as uint) */
                                 66                 :                : #define WRITE_OID_FIELD(fldname) \
                                 67                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
                                 68                 :                : 
                                 69                 :                : /* Write a long-integer field */
                                 70                 :                : #define WRITE_LONG_FIELD(fldname) \
                                 71                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
                                 72                 :                : 
                                 73                 :                : /* Write a char field (ie, one ascii character) */
                                 74                 :                : #define WRITE_CHAR_FIELD(fldname) \
                                 75                 :                :     (appendStringInfo(str, " :" CppAsString(fldname) " "), \
                                 76                 :                :      outChar(str, node->fldname))
                                 77                 :                : 
                                 78                 :                : /* Write an enumerated-type field as an integer code */
                                 79                 :                : #define WRITE_ENUM_FIELD(fldname, enumtype) \
                                 80                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %d", \
                                 81                 :                :                      (int) node->fldname)
                                 82                 :                : 
                                 83                 :                : /* Write a float field (actually, they're double) */
                                 84                 :                : #define WRITE_FLOAT_FIELD(fldname) \
                                 85                 :                :     (appendStringInfo(str, " :" CppAsString(fldname) " "), \
                                 86                 :                :      outDouble(str, node->fldname))
                                 87                 :                : 
                                 88                 :                : /* Write a boolean field */
                                 89                 :                : #define WRITE_BOOL_FIELD(fldname) \
                                 90                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %s", \
                                 91                 :                :                      booltostr(node->fldname))
                                 92                 :                : 
                                 93                 :                : /* Write a character-string (possibly NULL) field */
                                 94                 :                : #define WRITE_STRING_FIELD(fldname) \
                                 95                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                 96                 :                :      outToken(str, node->fldname))
                                 97                 :                : 
                                 98                 :                : /* Write a parse location field (actually same as INT case) */
                                 99                 :                : #define WRITE_LOCATION_FIELD(fldname) \
                                100                 :                :     appendStringInfo(str, " :" CppAsString(fldname) " %d", write_location_fields ? node->fldname : -1)
                                101                 :                : 
                                102                 :                : /* Write a Node field */
                                103                 :                : #define WRITE_NODE_FIELD(fldname) \
                                104                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                105                 :                :      outNode(str, node->fldname))
                                106                 :                : 
                                107                 :                : /* Write a bitmapset field */
                                108                 :                : #define WRITE_BITMAPSET_FIELD(fldname) \
                                109                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                110                 :                :      outBitmapset(str, node->fldname))
                                111                 :                : 
                                112                 :                : /* Write a variable-length array (not a List) of Node pointers */
                                113                 :                : #define WRITE_NODE_ARRAY(fldname, len) \
                                114                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                115                 :                :      writeNodeArray(str, (const Node * const *) node->fldname, len))
                                116                 :                : 
                                117                 :                : /* Write a variable-length array of AttrNumber */
                                118                 :                : #define WRITE_ATTRNUMBER_ARRAY(fldname, len) \
                                119                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                120                 :                :      writeAttrNumberCols(str, node->fldname, len))
                                121                 :                : 
                                122                 :                : /* Write a variable-length array of Oid */
                                123                 :                : #define WRITE_OID_ARRAY(fldname, len) \
                                124                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                125                 :                :      writeOidCols(str, node->fldname, len))
                                126                 :                : 
                                127                 :                : /* Write a variable-length array of Index */
                                128                 :                : #define WRITE_INDEX_ARRAY(fldname, len) \
                                129                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                130                 :                :      writeIndexCols(str, node->fldname, len))
                                131                 :                : 
                                132                 :                : /* Write a variable-length array of int */
                                133                 :                : #define WRITE_INT_ARRAY(fldname, len) \
                                134                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                135                 :                :      writeIntCols(str, node->fldname, len))
                                136                 :                : 
                                137                 :                : /* Write a variable-length array of bool */
                                138                 :                : #define WRITE_BOOL_ARRAY(fldname, len) \
                                139                 :                :     (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
                                140                 :                :      writeBoolCols(str, node->fldname, len))
                                141                 :                : 
                                142                 :                : #define booltostr(x)  ((x) ? "true" : "false")
                                143                 :                : 
                                144                 :                : 
                                145                 :                : /*
                                146                 :                :  * outToken
                                147                 :                :  *    Convert an ordinary string (eg, an identifier) into a form that
                                148                 :                :  *    will be decoded back to a plain token by read.c's functions.
                                149                 :                :  *
                                150                 :                :  *    If a null string pointer is given, it is encoded as '<>'.
                                151                 :                :  *    An empty string is encoded as '""'.  To avoid ambiguity, input
                                152                 :                :  *    strings beginning with '<' or '"' receive a leading backslash.
                                153                 :                :  */
                                154                 :                : void
 3277 tgl@sss.pgh.pa.us         155                 :CBC     1047291 : outToken(StringInfo str, const char *s)
                                156                 :                : {
 1076 peter@eisentraut.org      157         [ +  + ]:        1047291 :     if (s == NULL)
                                158                 :                :     {
 4328 rhaas@postgresql.org      159                 :          44771 :         appendStringInfoString(str, "<>");
 9367 tgl@sss.pgh.pa.us         160                 :          44771 :         return;
                                161                 :                :     }
 1076 peter@eisentraut.org      162         [ -  + ]:        1002520 :     if (*s == '\0')
                                163                 :                :     {
 1076 peter@eisentraut.org      164                 :UBC           0 :         appendStringInfoString(str, "\"\"");
                                165                 :              0 :         return;
                                166                 :                :     }
                                167                 :                : 
                                168                 :                :     /*
                                169                 :                :      * Look for characters or patterns that are treated specially by read.c
                                170                 :                :      * (either in pg_strtok() or in nodeRead()), and therefore need a
                                171                 :                :      * protective backslash.
                                172                 :                :      */
                                173                 :                :     /* These characters only need to be quoted at the start of the string */
 9367 tgl@sss.pgh.pa.us         174         [ +  + ]:CBC     1002520 :     if (*s == '<' ||
 3546 peter_e@gmx.net           175         [ +  - ]:        1002514 :         *s == '"' ||
 9043 tgl@sss.pgh.pa.us         176         [ +  - ]:        1002514 :         isdigit((unsigned char) *s) ||
 9007                           177   [ +  -  -  + ]:        1002514 :         ((*s == '+' || *s == '-') &&
 9007 tgl@sss.pgh.pa.us         178   [ #  #  #  # ]:UBC           0 :          (isdigit((unsigned char) s[1]) || s[1] == '.')))
 9367 tgl@sss.pgh.pa.us         179                 :CBC           6 :         appendStringInfoChar(str, '\\');
                                180         [ +  + ]:       10018766 :     while (*s)
                                181                 :                :     {
                                182                 :                :         /* These chars must be backslashed anywhere in the string */
                                183   [ +  +  +  -  :        9016246 :         if (*s == ' ' || *s == '\n' || *s == '\t' ||
                                              +  - ]
                                184   [ +  +  +  +  :        9010273 :             *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
                                        +  -  +  - ]
                                185         [ -  + ]:        9010249 :             *s == '\\')
                                186                 :           5997 :             appendStringInfoChar(str, '\\');
                                187                 :        9016246 :         appendStringInfoChar(str, *s++);
                                188                 :                :     }
                                189                 :                : }
                                190                 :                : 
                                191                 :                : /*
                                192                 :                :  * Convert one char.  Goes through outToken() so that special characters are
                                193                 :                :  * escaped.
                                194                 :                :  */
                                195                 :                : static void
 2999 peter_e@gmx.net           196                 :          37270 : outChar(StringInfo str, char c)
                                197                 :                : {
                                198                 :                :     char        in[2];
                                199                 :                : 
                                200                 :                :     /* Traditionally, we've represented \0 as <>, so keep doing that */
 1076 peter@eisentraut.org      201         [ +  + ]:          37270 :     if (c == '\0')
                                202                 :                :     {
                                203                 :           4791 :         appendStringInfoString(str, "<>");
                                204                 :           4791 :         return;
                                205                 :                :     }
                                206                 :                : 
 2999 peter_e@gmx.net           207                 :          32479 :     in[0] = c;
                                208                 :          32479 :     in[1] = '\0';
                                209                 :                : 
                                210                 :          32479 :     outToken(str, in);
                                211                 :                : }
                                212                 :                : 
                                213                 :                : /*
                                214                 :                :  * Convert a double value, attempting to ensure the value is preserved exactly.
                                215                 :                :  */
                                216                 :                : static void
 1076 peter@eisentraut.org      217                 :           4833 : outDouble(StringInfo str, double d)
                                218                 :                : {
                                219                 :                :     char        buf[DOUBLE_SHORTEST_DECIMAL_LEN];
                                220                 :                : 
                                221                 :           4833 :     double_to_shortest_decimal_buf(d, buf);
                                222                 :           4833 :     appendStringInfoString(str, buf);
                                223                 :           4833 : }
                                224                 :                : 
                                225                 :                : /*
                                226                 :                :  * common implementation for scalar-array-writing functions
                                227                 :                :  *
                                228                 :                :  * The data format is either "<>" for a NULL pointer or "(item item item)".
                                229                 :                :  * fmtstr must include a leading space, and the rest of it must produce
                                230                 :                :  * something that will be seen as a single simple token by pg_strtok().
                                231                 :                :  * convfunc can be empty, or the name of a conversion macro or function.
                                232                 :                :  */
                                233                 :                : #define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc) \
                                234                 :                : static void \
                                235                 :                : fnname(StringInfo str, const datatype *arr, int len) \
                                236                 :                : { \
                                237                 :                :     if (arr != NULL) \
                                238                 :                :     { \
                                239                 :                :         appendStringInfoChar(str, '('); \
                                240                 :                :         for (int i = 0; i < len; i++) \
                                241                 :                :             appendStringInfo(str, fmtstr, convfunc(arr[i])); \
                                242                 :                :         appendStringInfoChar(str, ')'); \
                                243                 :                :     } \
                                244                 :                :     else \
                                245                 :                :         appendStringInfoString(str, "<>"); \
                                246                 :                : }
                                247                 :                : 
 1144 tgl@sss.pgh.pa.us         248   [ +  +  +  + ]:            606 : WRITE_SCALAR_ARRAY(writeAttrNumberCols, AttrNumber, " %d",)
                                249   [ +  +  +  + ]:           1743 : WRITE_SCALAR_ARRAY(writeOidCols, Oid, " %u",)
 1144 tgl@sss.pgh.pa.us         250   [ #  #  #  # ]:UBC           0 : WRITE_SCALAR_ARRAY(writeIndexCols, Index, " %u",)
 1144 tgl@sss.pgh.pa.us         251   [ +  -  +  + ]:CBC        1521 : WRITE_SCALAR_ARRAY(writeIntCols, int, " %d",)
                                252   [ +  -  -  +  :            179 : WRITE_SCALAR_ARRAY(writeBoolCols, bool, " %s", booltostr)
                                              +  + ]
                                253                 :                : 
                                254                 :                : /*
                                255                 :                :  * Print an array (not a List) of Node pointers.
                                256                 :                :  *
                                257                 :                :  * The decoration is identical to that of scalar arrays, but we can't
                                258                 :                :  * quite use appendStringInfo() in the loop.
                                259                 :                :  */
                                260                 :                : static void
 1144 tgl@sss.pgh.pa.us         261                 :UBC           0 : writeNodeArray(StringInfo str, const Node *const *arr, int len)
                                262                 :                : {
                                263         [ #  # ]:              0 :     if (arr != NULL)
                                264                 :                :     {
                                265                 :              0 :         appendStringInfoChar(str, '(');
                                266         [ #  # ]:              0 :         for (int i = 0; i < len; i++)
                                267                 :                :         {
                                268                 :              0 :             appendStringInfoChar(str, ' ');
                                269                 :              0 :             outNode(str, arr[i]);
                                270                 :                :         }
                                271                 :              0 :         appendStringInfoChar(str, ')');
                                272                 :                :     }
                                273                 :                :     else
                                274                 :              0 :         appendStringInfoString(str, "<>");
                                275                 :              0 : }
                                276                 :                : 
                                277                 :                : /*
                                278                 :                :  * Print a List.
                                279                 :                :  */
                                280                 :                : static void
 5022 peter_e@gmx.net           281                 :CBC      273374 : _outList(StringInfo str, const List *node)
                                282                 :                : {
                                283                 :                :     const ListCell *lc;
                                284                 :                : 
 9367 tgl@sss.pgh.pa.us         285                 :         273374 :     appendStringInfoChar(str, '(');
                                286                 :                : 
 7773 neilc@samurai.com         287         [ +  + ]:         273374 :     if (IsA(node, IntList))
                                288                 :          16914 :         appendStringInfoChar(str, 'i');
                                289         [ +  + ]:         256460 :     else if (IsA(node, OidList))
                                290                 :           6374 :         appendStringInfoChar(str, 'o');
 1160 alvherre@alvh.no-ip.      291         [ -  + ]:         250086 :     else if (IsA(node, XidList))
 1160 alvherre@alvh.no-ip.      292                 :UBC           0 :         appendStringInfoChar(str, 'x');
                                293                 :                : 
 7678 bruce@momjian.us          294   [ +  -  +  +  :CBC     2288168 :     foreach(lc, node)
                                              +  + ]
                                295                 :                :     {
                                296                 :                :         /*
                                297                 :                :          * For the sake of backward compatibility, we emit a slightly
                                298                 :                :          * different whitespace format for lists of nodes vs. other types of
                                299                 :                :          * lists. XXX: is this necessary?
                                300                 :                :          */
 7773 neilc@samurai.com         301         [ +  + ]:        2014794 :         if (IsA(node, List))
                                302                 :                :         {
 3438 andres@anarazel.de        303                 :        1608337 :             outNode(str, lfirst(lc));
 2245 tgl@sss.pgh.pa.us         304         [ +  + ]:        1608337 :             if (lnext(node, lc))
 7773 neilc@samurai.com         305                 :        1358251 :                 appendStringInfoChar(str, ' ');
                                306                 :                :         }
                                307         [ +  + ]:         406457 :         else if (IsA(node, IntList))
                                308                 :         381415 :             appendStringInfo(str, " %d", lfirst_int(lc));
                                309         [ +  - ]:          25042 :         else if (IsA(node, OidList))
                                310                 :          25042 :             appendStringInfo(str, " %u", lfirst_oid(lc));
 1160 alvherre@alvh.no-ip.      311         [ #  # ]:UBC           0 :         else if (IsA(node, XidList))
                                312                 :              0 :             appendStringInfo(str, " %u", lfirst_xid(lc));
                                313                 :                :         else
 7678 bruce@momjian.us          314         [ #  # ]:              0 :             elog(ERROR, "unrecognized list node type: %d",
                                315                 :                :                  (int) node->type);
                                316                 :                :     }
                                317                 :                : 
 9007 tgl@sss.pgh.pa.us         318                 :CBC      273374 :     appendStringInfoChar(str, ')');
                                319                 :         273374 : }
                                320                 :                : 
                                321                 :                : /*
                                322                 :                :  * outBitmapset -
                                323                 :                :  *     converts a bitmap set of integers
                                324                 :                :  *
                                325                 :                :  * Note: the output format is "(b int int ...)", similar to an integer List.
                                326                 :                :  *
                                327                 :                :  * We export this function for use by extensions that define extensible nodes.
                                328                 :                :  * That's somewhat historical, though, because calling outNode() will work.
                                329                 :                :  */
                                330                 :                : void
 3277                           331                 :         621192 : outBitmapset(StringInfo str, const Bitmapset *bms)
                                332                 :                : {
                                333                 :                :     int         x;
                                334                 :                : 
 8246                           335                 :         621192 :     appendStringInfoChar(str, '(');
 7791                           336                 :         621192 :     appendStringInfoChar(str, 'b');
 3935                           337                 :         621192 :     x = -1;
                                338         [ +  + ]:         788481 :     while ((x = bms_next_member(bms, x)) >= 0)
 8246                           339                 :         167289 :         appendStringInfo(str, " %d", x);
                                340                 :         621192 :     appendStringInfoChar(str, ')');
                                341                 :         621192 : }
                                342                 :                : 
                                343                 :                : /*
                                344                 :                :  * Print the value of a Datum given its type.
                                345                 :                :  */
                                346                 :                : void
 3438 andres@anarazel.de        347                 :          78185 : outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
                                348                 :                : {
                                349                 :                :     Size        length,
                                350                 :                :                 i;
                                351                 :                :     char       *s;
                                352                 :                : 
 8304 tgl@sss.pgh.pa.us         353                 :          78185 :     length = datumGetSize(value, typbyval, typlen);
                                354                 :                : 
                                355         [ +  + ]:          78185 :     if (typbyval)
                                356                 :                :     {
                                357                 :          50678 :         s = (char *) (&value);
                                358                 :          50678 :         appendStringInfo(str, "%u [ ", (unsigned int) length);
                                359         [ +  + ]:         456102 :         for (i = 0; i < (Size) sizeof(Datum); i++)
                                360                 :         405424 :             appendStringInfo(str, "%d ", (int) (s[i]));
 4328 rhaas@postgresql.org      361                 :          50678 :         appendStringInfoChar(str, ']');
                                362                 :                :     }
                                363                 :                :     else
                                364                 :                :     {
 8304 tgl@sss.pgh.pa.us         365                 :          27507 :         s = (char *) DatumGetPointer(value);
                                366         [ -  + ]:          27507 :         if (!PointerIsValid(s))
 4328 rhaas@postgresql.org      367                 :UBC           0 :             appendStringInfoString(str, "0 [ ]");
                                368                 :                :         else
                                369                 :                :         {
 8304 tgl@sss.pgh.pa.us         370                 :CBC       27507 :             appendStringInfo(str, "%u [ ", (unsigned int) length);
                                371         [ +  + ]:        1012231 :             for (i = 0; i < length; i++)
                                372                 :         984724 :                 appendStringInfo(str, "%d ", (int) (s[i]));
 4328 rhaas@postgresql.org      373                 :          27507 :             appendStringInfoChar(str, ']');
                                374                 :                :         }
                                375                 :                :     }
10651 scrappy@hub.org           376                 :          78185 : }
                                377                 :                : 
                                378                 :                : 
                                379                 :                : #include "outfuncs.funcs.c"
                                380                 :                : 
                                381                 :                : 
                                382                 :                : /*
                                383                 :                :  * Support functions for nodes with custom_read_write attribute or
                                384                 :                :  * special_read_write attribute
                                385                 :                :  */
                                386                 :                : 
                                387                 :                : static void
 1155 peter@eisentraut.org      388                 :          90765 : _outConst(StringInfo str, const Const *node)
                                389                 :                : {
                                390                 :          90765 :     WRITE_NODE_TYPE("CONST");
                                391                 :                : 
                                392                 :          90765 :     WRITE_OID_FIELD(consttype);
                                393                 :          90765 :     WRITE_INT_FIELD(consttypmod);
                                394                 :          90765 :     WRITE_OID_FIELD(constcollid);
                                395                 :          90765 :     WRITE_INT_FIELD(constlen);
                                396         [ +  + ]:          90765 :     WRITE_BOOL_FIELD(constbyval);
                                397         [ +  + ]:          90765 :     WRITE_BOOL_FIELD(constisnull);
                                398         [ -  + ]:          90765 :     WRITE_LOCATION_FIELD(location);
                                399                 :                : 
                                400                 :          90765 :     appendStringInfoString(str, " :constvalue ");
                                401         [ +  + ]:          90765 :     if (node->constisnull)
                                402                 :          12580 :         appendStringInfoString(str, "<>");
                                403                 :                :     else
                                404                 :          78185 :         outDatum(str, node->constvalue, node->constlen, node->constbyval);
 8321 tgl@sss.pgh.pa.us         405                 :          90765 : }
                                406                 :                : 
                                407                 :                : static void
 1155 peter@eisentraut.org      408                 :          11598 : _outBoolExpr(StringInfo str, const BoolExpr *node)
                                409                 :                : {
                                410                 :          11598 :     char       *opstr = NULL;
                                411                 :                : 
                                412                 :          11598 :     WRITE_NODE_TYPE("BOOLEXPR");
                                413                 :                : 
                                414                 :                :     /* do-it-yourself enum representation */
                                415   [ +  +  +  - ]:          11598 :     switch (node->boolop)
                                416                 :                :     {
                                417                 :           7037 :         case AND_EXPR:
                                418                 :           7037 :             opstr = "and";
                                419                 :           7037 :             break;
                                420                 :           3073 :         case OR_EXPR:
                                421                 :           3073 :             opstr = "or";
                                422                 :           3073 :             break;
                                423                 :           1488 :         case NOT_EXPR:
                                424                 :           1488 :             opstr = "not";
                                425                 :           1488 :             break;
                                426                 :                :     }
                                427                 :          11598 :     appendStringInfoString(str, " :boolop ");
                                428                 :          11598 :     outToken(str, opstr);
                                429                 :                : 
                                430                 :          11598 :     WRITE_NODE_FIELD(args);
                                431         [ -  + ]:          11598 :     WRITE_LOCATION_FIELD(location);
 8321 tgl@sss.pgh.pa.us         432                 :          11598 : }
                                433                 :                : 
                                434                 :                : static void
 1155 peter@eisentraut.org      435                 :UBC           0 : _outForeignKeyOptInfo(StringInfo str, const ForeignKeyOptInfo *node)
                                436                 :                : {
                                437                 :                :     int         i;
                                438                 :                : 
                                439                 :              0 :     WRITE_NODE_TYPE("FOREIGNKEYOPTINFO");
                                440                 :                : 
                                441                 :              0 :     WRITE_UINT_FIELD(con_relid);
                                442                 :              0 :     WRITE_UINT_FIELD(ref_relid);
                                443                 :              0 :     WRITE_INT_FIELD(nkeys);
                                444                 :              0 :     WRITE_ATTRNUMBER_ARRAY(conkey, node->nkeys);
                                445                 :              0 :     WRITE_ATTRNUMBER_ARRAY(confkey, node->nkeys);
                                446                 :              0 :     WRITE_OID_ARRAY(conpfeqop, node->nkeys);
                                447                 :              0 :     WRITE_INT_FIELD(nmatched_ec);
                                448                 :              0 :     WRITE_INT_FIELD(nconst_ec);
                                449                 :              0 :     WRITE_INT_FIELD(nmatched_rcols);
                                450                 :              0 :     WRITE_INT_FIELD(nmatched_ri);
                                451                 :                :     /* for compactness, just print the number of matches per column: */
                                452                 :              0 :     appendStringInfoString(str, " :eclass");
                                453         [ #  # ]:              0 :     for (i = 0; i < node->nkeys; i++)
                                454                 :              0 :         appendStringInfo(str, " %d", (node->eclass[i] != NULL));
                                455                 :              0 :     appendStringInfoString(str, " :rinfos");
                                456         [ #  # ]:              0 :     for (i = 0; i < node->nkeys; i++)
                                457                 :              0 :         appendStringInfo(str, " %d", list_length(node->rinfos[i]));
 3153 andres@anarazel.de        458                 :              0 : }
                                459                 :                : 
                                460                 :                : static void
 1155 peter@eisentraut.org      461                 :              0 : _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
                                462                 :                : {
                                463                 :                :     /*
                                464                 :                :      * To simplify reading, we just chase up to the topmost merged EC and
                                465                 :                :      * print that, without bothering to show the merge-ees separately.
                                466                 :                :      */
                                467         [ #  # ]:              0 :     while (node->ec_merged)
                                468                 :              0 :         node = node->ec_merged;
                                469                 :                : 
                                470                 :              0 :     WRITE_NODE_TYPE("EQUIVALENCECLASS");
                                471                 :                : 
                                472                 :              0 :     WRITE_NODE_FIELD(ec_opfamilies);
                                473                 :              0 :     WRITE_OID_FIELD(ec_collation);
  151 drowley@postgresql.o      474                 :              0 :     WRITE_INT_FIELD(ec_childmembers_size);
 1155 peter@eisentraut.org      475                 :              0 :     WRITE_NODE_FIELD(ec_members);
  151 drowley@postgresql.o      476                 :              0 :     WRITE_NODE_ARRAY(ec_childmembers, node->ec_childmembers_size);
 1155 peter@eisentraut.org      477                 :              0 :     WRITE_NODE_FIELD(ec_sources);
                                478                 :                :     /* Only ec_derives_list is written; hash is not serialized. */
  155 amitlan@postgresql.o      479                 :              0 :     WRITE_NODE_FIELD(ec_derives_list);
 1155 peter@eisentraut.org      480                 :              0 :     WRITE_BITMAPSET_FIELD(ec_relids);
                                481         [ #  # ]:              0 :     WRITE_BOOL_FIELD(ec_has_const);
                                482         [ #  # ]:              0 :     WRITE_BOOL_FIELD(ec_has_volatile);
                                483         [ #  # ]:              0 :     WRITE_BOOL_FIELD(ec_broken);
                                484                 :              0 :     WRITE_UINT_FIELD(ec_sortref);
                                485                 :              0 :     WRITE_UINT_FIELD(ec_min_security);
                                486                 :              0 :     WRITE_UINT_FIELD(ec_max_security);
 5810 tgl@sss.pgh.pa.us         487                 :              0 : }
                                488                 :                : 
                                489                 :                : static void
 1155 peter@eisentraut.org      490                 :              0 : _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
                                491                 :                : {
                                492                 :                :     const ExtensibleNodeMethods *methods;
                                493                 :                : 
                                494                 :              0 :     methods = GetExtensibleNodeMethods(node->extnodename, false);
                                495                 :                : 
                                496                 :              0 :     WRITE_NODE_TYPE("EXTENSIBLENODE");
                                497                 :                : 
                                498                 :              0 :     WRITE_STRING_FIELD(extnodename);
                                499                 :                : 
                                500                 :                :     /* serialize the private fields */
                                501                 :              0 :     methods->nodeOut(str, node);
 5441 tgl@sss.pgh.pa.us         502                 :              0 : }
                                503                 :                : 
                                504                 :                : static void
 1155 peter@eisentraut.org      505                 :CBC       41699 : _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
                                506                 :                : {
                                507                 :          41699 :     WRITE_NODE_TYPE("RANGETBLENTRY");
                                508                 :                : 
                                509                 :          41699 :     WRITE_NODE_FIELD(alias);
                                510                 :          41699 :     WRITE_NODE_FIELD(eref);
                                511                 :          41699 :     WRITE_ENUM_FIELD(rtekind, RTEKind);
                                512                 :                : 
                                513   [ +  +  +  +  :          41699 :     switch (node->rtekind)
                                     +  +  +  +  +  
                                              +  - ]
                                514                 :                :     {
                                515                 :          26244 :         case RTE_RELATION:
                                516                 :          26244 :             WRITE_OID_FIELD(relid);
  548                           517         [ +  + ]:          26244 :             WRITE_BOOL_FIELD(inh);
 1155                           518                 :          26244 :             WRITE_CHAR_FIELD(relkind);
                                519                 :          26244 :             WRITE_INT_FIELD(rellockmode);
 1005 alvherre@alvh.no-ip.      520                 :          26244 :             WRITE_UINT_FIELD(perminfoindex);
  550 peter@eisentraut.org      521                 :          26244 :             WRITE_NODE_FIELD(tablesample);
 1155                           522                 :          26244 :             break;
                                523                 :           4800 :         case RTE_SUBQUERY:
                                524                 :           4800 :             WRITE_NODE_FIELD(subquery);
                                525         [ -  + ]:           4800 :             WRITE_BOOL_FIELD(security_barrier);
                                526                 :                :             /* we re-use these RELATION fields, too: */
  962 tgl@sss.pgh.pa.us         527                 :           4800 :             WRITE_OID_FIELD(relid);
  548 peter@eisentraut.org      528         [ +  + ]:           4800 :             WRITE_BOOL_FIELD(inh);
  816 amitlan@postgresql.o      529                 :           4800 :             WRITE_CHAR_FIELD(relkind);
  962 tgl@sss.pgh.pa.us         530                 :           4800 :             WRITE_INT_FIELD(rellockmode);
                                531                 :           4800 :             WRITE_UINT_FIELD(perminfoindex);
 1155 peter@eisentraut.org      532                 :           4800 :             break;
                                533                 :           7420 :         case RTE_JOIN:
                                534                 :           7420 :             WRITE_ENUM_FIELD(jointype, JoinType);
                                535                 :           7420 :             WRITE_INT_FIELD(joinmergedcols);
                                536                 :           7420 :             WRITE_NODE_FIELD(joinaliasvars);
                                537                 :           7420 :             WRITE_NODE_FIELD(joinleftcols);
                                538                 :           7420 :             WRITE_NODE_FIELD(joinrightcols);
                                539                 :           7420 :             WRITE_NODE_FIELD(join_using_alias);
                                540                 :           7420 :             break;
                                541                 :           2663 :         case RTE_FUNCTION:
                                542                 :           2663 :             WRITE_NODE_FIELD(functions);
                                543         [ +  + ]:           2663 :             WRITE_BOOL_FIELD(funcordinality);
                                544                 :           2663 :             break;
                                545                 :             41 :         case RTE_TABLEFUNC:
                                546                 :             41 :             WRITE_NODE_FIELD(tablefunc);
                                547                 :             41 :             break;
                                548                 :            177 :         case RTE_VALUES:
                                549                 :            177 :             WRITE_NODE_FIELD(values_lists);
                                550                 :            177 :             WRITE_NODE_FIELD(coltypes);
                                551                 :            177 :             WRITE_NODE_FIELD(coltypmods);
                                552                 :            177 :             WRITE_NODE_FIELD(colcollations);
                                553                 :            177 :             break;
                                554                 :             75 :         case RTE_CTE:
                                555                 :             75 :             WRITE_STRING_FIELD(ctename);
                                556                 :             75 :             WRITE_UINT_FIELD(ctelevelsup);
                                557         [ +  + ]:             75 :             WRITE_BOOL_FIELD(self_reference);
                                558                 :             75 :             WRITE_NODE_FIELD(coltypes);
                                559                 :             75 :             WRITE_NODE_FIELD(coltypmods);
                                560                 :             75 :             WRITE_NODE_FIELD(colcollations);
                                561                 :             75 :             break;
                                562                 :              3 :         case RTE_NAMEDTUPLESTORE:
                                563                 :              3 :             WRITE_STRING_FIELD(enrname);
 1076                           564                 :              3 :             WRITE_FLOAT_FIELD(enrtuples);
 1155                           565                 :              3 :             WRITE_NODE_FIELD(coltypes);
                                566                 :              3 :             WRITE_NODE_FIELD(coltypmods);
                                567                 :              3 :             WRITE_NODE_FIELD(colcollations);
                                568                 :                :             /* we re-use these RELATION fields, too: */
  962 tgl@sss.pgh.pa.us         569                 :              3 :             WRITE_OID_FIELD(relid);
 1155 peter@eisentraut.org      570                 :              3 :             break;
                                571                 :             42 :         case RTE_RESULT:
                                572                 :                :             /* no extra fields */
                                573                 :             42 :             break;
  361 rguo@postgresql.org       574                 :            234 :         case RTE_GROUP:
                                575                 :            234 :             WRITE_NODE_FIELD(groupexprs);
                                576                 :            234 :             break;
 1155 peter@eisentraut.org      577                 :UBC           0 :         default:
                                578         [ #  # ]:              0 :             elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
                                579                 :                :             break;
                                580                 :                :     }
                                581                 :                : 
 1155 peter@eisentraut.org      582         [ +  + ]:CBC       41699 :     WRITE_BOOL_FIELD(lateral);
                                583         [ +  + ]:          41699 :     WRITE_BOOL_FIELD(inFromCl);
                                584                 :          41699 :     WRITE_NODE_FIELD(securityQuals);
 7445 tgl@sss.pgh.pa.us         585                 :          41699 : }
                                586                 :                : 
                                587                 :                : static void
 1155 peter@eisentraut.org      588                 :UBC           0 : _outA_Expr(StringInfo str, const A_Expr *node)
                                589                 :                : {
                                590                 :              0 :     WRITE_NODE_TYPE("A_EXPR");
                                591                 :                : 
                                592   [ #  #  #  #  :              0 :     switch (node->kind)
                                     #  #  #  #  #  
                                     #  #  #  #  #  
                                                 # ]
                                593                 :                :     {
                                594                 :              0 :         case AEXPR_OP:
                                595                 :              0 :             WRITE_NODE_FIELD(name);
                                596                 :              0 :             break;
                                597                 :              0 :         case AEXPR_OP_ANY:
 1118                           598                 :              0 :             appendStringInfoString(str, " ANY");
 1078                           599                 :              0 :             WRITE_NODE_FIELD(name);
 1155                           600                 :              0 :             break;
                                601                 :              0 :         case AEXPR_OP_ALL:
 1118                           602                 :              0 :             appendStringInfoString(str, " ALL");
 1078                           603                 :              0 :             WRITE_NODE_FIELD(name);
 1155                           604                 :              0 :             break;
                                605                 :              0 :         case AEXPR_DISTINCT:
 1118                           606                 :              0 :             appendStringInfoString(str, " DISTINCT");
 1155                           607                 :              0 :             WRITE_NODE_FIELD(name);
                                608                 :              0 :             break;
                                609                 :              0 :         case AEXPR_NOT_DISTINCT:
 1118                           610                 :              0 :             appendStringInfoString(str, " NOT_DISTINCT");
 1155                           611                 :              0 :             WRITE_NODE_FIELD(name);
                                612                 :              0 :             break;
                                613                 :              0 :         case AEXPR_NULLIF:
 1118                           614                 :              0 :             appendStringInfoString(str, " NULLIF");
 1155                           615                 :              0 :             WRITE_NODE_FIELD(name);
                                616                 :              0 :             break;
                                617                 :              0 :         case AEXPR_IN:
 1118                           618                 :              0 :             appendStringInfoString(str, " IN");
 1155                           619                 :              0 :             WRITE_NODE_FIELD(name);
                                620                 :              0 :             break;
                                621                 :              0 :         case AEXPR_LIKE:
 1118                           622                 :              0 :             appendStringInfoString(str, " LIKE");
 1155                           623                 :              0 :             WRITE_NODE_FIELD(name);
                                624                 :              0 :             break;
                                625                 :              0 :         case AEXPR_ILIKE:
 1118                           626                 :              0 :             appendStringInfoString(str, " ILIKE");
 1155                           627                 :              0 :             WRITE_NODE_FIELD(name);
                                628                 :              0 :             break;
                                629                 :              0 :         case AEXPR_SIMILAR:
 1118                           630                 :              0 :             appendStringInfoString(str, " SIMILAR");
 1155                           631                 :              0 :             WRITE_NODE_FIELD(name);
                                632                 :              0 :             break;
                                633                 :              0 :         case AEXPR_BETWEEN:
 1118                           634                 :              0 :             appendStringInfoString(str, " BETWEEN");
 1155                           635                 :              0 :             WRITE_NODE_FIELD(name);
                                636                 :              0 :             break;
                                637                 :              0 :         case AEXPR_NOT_BETWEEN:
 1118                           638                 :              0 :             appendStringInfoString(str, " NOT_BETWEEN");
 1155                           639                 :              0 :             WRITE_NODE_FIELD(name);
                                640                 :              0 :             break;
                                641                 :              0 :         case AEXPR_BETWEEN_SYM:
 1118                           642                 :              0 :             appendStringInfoString(str, " BETWEEN_SYM");
 1155                           643                 :              0 :             WRITE_NODE_FIELD(name);
                                644                 :              0 :             break;
                                645                 :              0 :         case AEXPR_NOT_BETWEEN_SYM:
 1118                           646                 :              0 :             appendStringInfoString(str, " NOT_BETWEEN_SYM");
 1155                           647                 :              0 :             WRITE_NODE_FIELD(name);
                                648                 :              0 :             break;
                                649                 :              0 :         default:
 1078                           650         [ #  # ]:              0 :             elog(ERROR, "unrecognized A_Expr_Kind: %d", (int) node->kind);
                                651                 :                :             break;
                                652                 :                :     }
                                653                 :                : 
 1155                           654                 :              0 :     WRITE_NODE_FIELD(lexpr);
                                655                 :              0 :     WRITE_NODE_FIELD(rexpr);
   86 alvherre@kurilemu.de      656         [ #  # ]:              0 :     WRITE_LOCATION_FIELD(rexpr_list_start);
                                657         [ #  # ]:              0 :     WRITE_LOCATION_FIELD(rexpr_list_end);
 1155 peter@eisentraut.org      658         [ #  # ]:              0 :     WRITE_LOCATION_FIELD(location);
10651 scrappy@hub.org           659                 :              0 : }
                                660                 :                : 
                                661                 :                : static void
 1155 peter@eisentraut.org      662                 :              0 : _outInteger(StringInfo str, const Integer *node)
                                663                 :                : {
                                664                 :              0 :     appendStringInfo(str, "%d", node->ival);
10651 scrappy@hub.org           665                 :              0 : }
                                666                 :                : 
                                667                 :                : static void
 1155 peter@eisentraut.org      668                 :              0 : _outFloat(StringInfo str, const Float *node)
                                669                 :                : {
                                670                 :                :     /*
                                671                 :                :      * We assume the value is a valid numeric literal and so does not need
                                672                 :                :      * quoting.
                                673                 :                :      */
                                674                 :              0 :     appendStringInfoString(str, node->fval);
 3696 tgl@sss.pgh.pa.us         675                 :              0 : }
                                676                 :                : 
                                677                 :                : static void
 1155 peter@eisentraut.org      678                 :              0 : _outBoolean(StringInfo str, const Boolean *node)
                                679                 :                : {
                                680         [ #  # ]:              0 :     appendStringInfoString(str, node->boolval ? "true" : "false");
 5079 tgl@sss.pgh.pa.us         681                 :              0 : }
                                682                 :                : 
                                683                 :                : static void
 1155 peter@eisentraut.org      684                 :CBC      784530 : _outString(StringInfo str, const String *node)
                                685                 :                : {
                                686                 :                :     /*
                                687                 :                :      * We use outToken to provide escaping of the string's content, but we
                                688                 :                :      * don't want it to convert an empty string to '""', because we're putting
                                689                 :                :      * double quotes around the string already.
                                690                 :                :      */
                                691                 :         784530 :     appendStringInfoChar(str, '"');
                                692         [ +  + ]:         784530 :     if (node->sval[0] != '\0')
                                693                 :         784452 :         outToken(str, node->sval);
                                694                 :         784530 :     appendStringInfoChar(str, '"');
10651 scrappy@hub.org           695                 :         784530 : }
                                696                 :                : 
                                697                 :                : static void
 1155 peter@eisentraut.org      698                 :UBC           0 : _outBitString(StringInfo str, const BitString *node)
                                699                 :                : {
                                700                 :                :     /*
                                701                 :                :      * The lexer will always produce a string starting with 'b' or 'x'.  There
                                702                 :                :      * might be characters following that that need escaping, but outToken
                                703                 :                :      * won't escape the 'b' or 'x'.  This is relied on by nodeTokenType.
                                704                 :                :      */
  571 tgl@sss.pgh.pa.us         705   [ #  #  #  # ]:              0 :     Assert(node->bsval[0] == 'b' || node->bsval[0] == 'x');
                                706                 :              0 :     outToken(str, node->bsval);
 7445                           707                 :              0 : }
                                708                 :                : 
                                709                 :                : static void
 1155 peter@eisentraut.org      710                 :              0 : _outA_Const(StringInfo str, const A_Const *node)
                                711                 :                : {
                                712                 :              0 :     WRITE_NODE_TYPE("A_CONST");
                                713                 :                : 
                                714         [ #  # ]:              0 :     if (node->isnull)
 1122                           715                 :              0 :         appendStringInfoString(str, " NULL");
                                716                 :                :     else
                                717                 :                :     {
 1155                           718                 :              0 :         appendStringInfoString(str, " :val ");
                                719                 :              0 :         outNode(str, &node->val);
                                720                 :                :     }
                                721         [ #  # ]:              0 :     WRITE_LOCATION_FIELD(location);
 7445 tgl@sss.pgh.pa.us         722                 :              0 : }
                                723                 :                : 
                                724                 :                : 
                                725                 :                : /*
                                726                 :                :  * outNode -
                                727                 :                :  *    converts a Node into ascii string and append it to 'str'
                                728                 :                :  */
                                729                 :                : void
 1155 peter@eisentraut.org      730                 :CBC     2794368 : outNode(StringInfo str, const void *obj)
                                731                 :                : {
                                732                 :                :     /* Guard against stack overflow due to overly complex expressions */
                                733                 :        2794368 :     check_stack_depth();
                                734                 :                : 
10226 bruce@momjian.us          735         [ +  + ]:        2794368 :     if (obj == NULL)
 4328 rhaas@postgresql.org      736                 :         563169 :         appendStringInfoString(str, "<>");
 1151 alvherre@alvh.no-ip.      737   [ +  +  +  +  :        2231199 :     else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList) ||
                                              +  + ]
                                738         [ -  + ]:        1957825 :              IsA(obj, XidList))
 7773 neilc@samurai.com         739                 :         273374 :         _outList(str, obj);
                                740                 :                :     /* nodeRead does not want to see { } around these! */
 1458 peter@eisentraut.org      741         [ -  + ]:        1957825 :     else if (IsA(obj, Integer))
 1458 peter@eisentraut.org      742                 :UBC           0 :         _outInteger(str, (Integer *) obj);
 1458 peter@eisentraut.org      743         [ -  + ]:CBC     1957825 :     else if (IsA(obj, Float))
 1458 peter@eisentraut.org      744                 :UBC           0 :         _outFloat(str, (Float *) obj);
 1331 peter@eisentraut.org      745         [ -  + ]:CBC     1957825 :     else if (IsA(obj, Boolean))
 1331 peter@eisentraut.org      746                 :UBC           0 :         _outBoolean(str, (Boolean *) obj);
 1458 peter@eisentraut.org      747         [ +  + ]:CBC     1957825 :     else if (IsA(obj, String))
                                748                 :         784530 :         _outString(str, (String *) obj);
                                749         [ -  + ]:        1173295 :     else if (IsA(obj, BitString))
 1458 peter@eisentraut.org      750                 :UBC           0 :         _outBitString(str, (BitString *) obj);
 1028 tgl@sss.pgh.pa.us         751         [ -  + ]:CBC     1173295 :     else if (IsA(obj, Bitmapset))
 1028 tgl@sss.pgh.pa.us         752                 :UBC           0 :         outBitmapset(str, (Bitmapset *) obj);
                                753                 :                :     else
                                754                 :                :     {
 9367 tgl@sss.pgh.pa.us         755                 :CBC     1173295 :         appendStringInfoChar(str, '{');
10226 bruce@momjian.us          756   [ +  -  +  -  :        1173295 :         switch (nodeTag(obj))
                                     +  +  +  +  +  
                                     +  -  +  +  +  
                                     +  +  +  +  +  
                                     +  +  +  -  +  
                                     +  +  +  +  -  
                                     +  +  +  +  +  
                                     +  +  +  +  +  
                                     +  +  +  +  +  
                                     +  +  +  +  +  
                                     +  +  +  +  +  
                                     +  +  -  -  +  
                                     -  +  +  +  +  
                                     +  +  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  +  +  -  
                                     +  +  +  +  -  
                                     +  +  +  +  -  
                                     -  -  +  +  +  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  +  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  +  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  -  -  -  -  
                                     -  +  +  +  -  
                                     +  -  -  -  -  
                                     +  -  +  +  +  
                                     +  -  -  -  +  
                                     -  -  -  -  -  
                                     -  -  +  +  +  
                                     +  -  +  +  -  
                                     -  +  -  +  -  
                                     -  +  -  -  +  
                                     -  +  +  +  +  
                                        -  -  -  -  
                                                 - ]
                                757                 :                :         {
                                758                 :                : #include "outfuncs.switch.c"
                                759                 :                : 
10225 bruce@momjian.us          760                 :UBC           0 :             default:
                                761                 :                : 
                                762                 :                :                 /*
                                763                 :                :                  * This should be an ERROR, but it's too useful to be able to
                                764                 :                :                  * dump structures that outNode only understands part of.
                                765                 :                :                  */
 8082 tgl@sss.pgh.pa.us         766         [ #  # ]:              0 :                 elog(WARNING, "could not dump unrecognized node type: %d",
                                767                 :                :                      (int) nodeTag(obj));
10225 bruce@momjian.us          768                 :              0 :                 break;
                                769                 :                :         }
 9367 tgl@sss.pgh.pa.us         770                 :CBC     1173295 :         appendStringInfoChar(str, '}');
                                771                 :                :     }
10651 scrappy@hub.org           772                 :        2794368 : }
                                773                 :                : 
                                774                 :                : /*
                                775                 :                :  * nodeToString -
                                776                 :                :  *     returns the ascii representation of the Node as a palloc'd string
                                777                 :                :  *
                                778                 :                :  * write_loc_fields determines whether location fields are output with their
                                779                 :                :  * actual value rather than -1.  The actual value can be useful for debugging,
                                780                 :                :  * but for most uses, the actual value is not useful, since the original query
                                781                 :                :  * string is no longer available.
                                782                 :                :  */
                                783                 :                : static char *
  533 peter@eisentraut.org      784                 :          34232 : nodeToStringInternal(const void *obj, bool write_loc_fields)
                                785                 :                : {
                                786                 :                :     StringInfoData str;
                                787                 :                :     bool        save_write_location_fields;
                                788                 :                : 
                                789                 :          34232 :     save_write_location_fields = write_location_fields;
                                790                 :          34232 :     write_location_fields = write_loc_fields;
                                791                 :                : 
                                792                 :                :     /* see stringinfo.h for an explanation of this maneuver */
 9631 tgl@sss.pgh.pa.us         793                 :          34232 :     initStringInfo(&str);
 3438 andres@anarazel.de        794                 :          34232 :     outNode(&str, obj);
                                795                 :                : 
  533 peter@eisentraut.org      796                 :          34232 :     write_location_fields = save_write_location_fields;
                                797                 :                : 
 9631 tgl@sss.pgh.pa.us         798                 :          34232 :     return str.data;
                                799                 :                : }
                                800                 :                : 
                                801                 :                : /*
                                802                 :                :  * Externally visible entry points
                                803                 :                :  */
                                804                 :                : char *
  533 peter@eisentraut.org      805                 :          34232 : nodeToString(const void *obj)
                                806                 :                : {
                                807                 :          34232 :     return nodeToStringInternal(obj, false);
                                808                 :                : }
                                809                 :                : 
                                810                 :                : char *
  533 peter@eisentraut.org      811                 :UBC           0 : nodeToStringWithLocations(const void *obj)
                                812                 :                : {
                                813                 :              0 :     return nodeToStringInternal(obj, true);
                                814                 :                : }
                                815                 :                : 
                                816                 :                : 
                                817                 :                : /*
                                818                 :                :  * bmsToString -
                                819                 :                :  *     returns the ascii representation of the Bitmapset as a palloc'd string
                                820                 :                :  */
                                821                 :                : char *
 3277 tgl@sss.pgh.pa.us         822                 :              0 : bmsToString(const Bitmapset *bms)
                                823                 :                : {
                                824                 :                :     StringInfoData str;
                                825                 :                : 
                                826                 :                :     /* see stringinfo.h for an explanation of this maneuver */
                                827                 :              0 :     initStringInfo(&str);
                                828                 :              0 :     outBitmapset(&str, bms);
                                829                 :              0 :     return str.data;
                                830                 :                : }
        

Generated by: LCOV version 2.4-beta