OSDN Git Service

Bruce,
authorBruce Momjian <bruce@momjian.us>
Thu, 20 Jan 2000 15:13:19 +0000 (15:13 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 20 Jan 2000 15:13:19 +0000 (15:13 +0000)
Attached is a small fix for a stupid mistake I made in comment.c
- an attempt to drop a non-existent comment would dump core :-(.
Sometimes, I'm as sharp as a marble.

Sorry,

Mike Mascari

src/backend/commands/comment.c

index dc82476..96f47b3 100644 (file)
@@ -171,9 +171,15 @@ void CreateComments(Oid oid, char *comment) {
     }
 
   } else {
-    desctuple = heap_formtuple(tupDesc, values, nulls);
-    heap_insert(description, desctuple);
-    modified = TRUE;
+
+       /*** Only if comment is non-blank do we form a new tuple ***/
+
+       if ((comment != NULL) && (strlen(comment) > 0)) {
+               desctuple = heap_formtuple(tupDesc, values, nulls);
+               heap_insert(description, desctuple);
+               modified = TRUE;
+       }
+
   }
 
   /*** Complete the scan, update indices, if necessary ***/