Fix outfuncs.c to dump A_Const nodes representing NULLs correctly. This has
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Jul 2007 01:22:11 +0000 (01:22 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Jul 2007 01:22:11 +0000 (01:22 +0000)
been broken since forever, but was not noticed because people seldom look
at raw parse trees.  AFAIK, no impact on users except that debug_print_parse
might fail; but patch it all the way back anyway.  Per report from Jeff Ross.

src/backend/nodes/outfuncs.c

index cf65ed953e60b4ccf6f35e011b62495d2db23d8a..a42cb89f18138702f41ee171c7e1c1265b6958af 100644 (file)
@@ -1476,6 +1476,10 @@ _outValue(StringInfo str, Value *value)
                        /* internal representation already has leading 'b' */
                        appendStringInfoString(str, value->val.str);
                        break;
+               case T_Null:
+                       /* this is seen only within A_Const, not in transformed trees */
+                       appendStringInfoString(str, "NULL");
+                       break;
                default:
                        elog(ERROR, "unrecognized node type: %d", (int) value->type);
                        break;
@@ -1503,6 +1507,7 @@ _outAConst(StringInfo str, A_Const *node)
 {
        WRITE_NODE_TYPE("A_CONST");
 
+       appendStringInfo(str, " :val ");
        _outValue(str, &(node->val));
        WRITE_NODE_FIELD(typename);
 }