]> granicus.if.org Git - postgresql/commitdiff
Change some labels in bootparse to make ctags happy. Clean up outfunc/readfunc code...
authorBruce Momjian <bruce@momjian.us>
Tue, 6 Jan 1998 18:53:02 +0000 (18:53 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 6 Jan 1998 18:53:02 +0000 (18:53 +0000)
15 files changed:
contrib/array/array_iterator.c
contrib/datetime/datetime_functions.c
contrib/int8/int8.c
contrib/spi/autoinc.c
contrib/spi/insert_username.c
contrib/spi/refint.c
contrib/spi/timetravel.c
src/backend/bootstrap/bootparse.y
src/backend/catalog/aclchk.c
src/backend/lib/stringinfo.c
src/backend/nodes/outfuncs.c
src/backend/nodes/read.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/path/prune.c
src/test/regress/regress.c

index de8dac95de0d371b0998e73bfdb022d23d753ab2..53130bf7a961fb0227443ff9a9f051411ee4a4aa 100644 (file)
@@ -56,7 +56,7 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
     /* Lookup element type information */
     typ_tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(elemtype),0,0,0);
     if (!HeapTupleIsValid(typ_tuple)) {
-        elog(WARN,"array_iterator: cache lookup failed for type %d", elemtype);
+        elog(ERROR,"array_iterator: cache lookup failed for type %d", elemtype);
         return 0;
     }
     typ_struct = (TypeTupleForm) GETSTRUCT(typ_tuple);
@@ -67,7 +67,7 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
     proc_fn = (func_ptr) NULL;
     fmgr_info(proc, &proc_fn, &pronargs);
     if ((proc_fn == NULL) || (pronargs != 2)) {
-       elog(WARN, "array_iterator: fmgr_info lookup failed for oid %d", proc);
+       elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
         return (0);
     }
 
index e925d985bfb6fb7b0ca433663c48056bd5f574b8..b96761bc8f80b31caef6dc90dab8f16ad104ed7c 100644 (file)
@@ -47,23 +47,23 @@ hhmm_in(char *str)
     int ftype[MAXDATEFIELDS];
 
     if (!PointerIsValid(str))
-        elog(WARN,"Bad (null) time external representation",NULL);
+        elog(ERROR,"Bad (null) time external representation",NULL);
 
     if ((ParseDateTime( str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
      || (DecodeTimeOnly( field, ftype, nf, &dtype, tm, &fsec) != 0))
-        elog(WARN,"Bad time external representation '%s'",str);
+        elog(ERROR,"Bad time external representation '%s'",str);
 
     if (tm->tm_hour<0 || tm->tm_hour>24 || 
        (tm->tm_hour==24 && (tm->tm_min!=0 || tm->tm_sec!=0 || fsec!= 0))) {
-        elog(WARN,
+        elog(ERROR,
             "time_in: hour must be limited to values 0 through 24:00 "
             "in \"%s\"",
             str);
     }
     if ((tm->tm_min < 0) || (tm->tm_min > 59))
-       elog(WARN,"Minute must be limited to values 0 through 59 in '%s'",str);
+       elog(ERROR,"Minute must be limited to values 0 through 59 in '%s'",str);
     if ((tm->tm_sec < 0) || ((tm->tm_sec + fsec) >= 60))
-       elog(WARN,"Second must be limited to values 0 through < 60 in '%s'",
+       elog(ERROR,"Second must be limited to values 0 through < 60 in '%s'",
             str);
 
     time = PALLOCTYPE(TimeADT);
index 6685370592a0c10a329523592fa8a5d0a971654f..afb3b6a93e79cfef8fd17e771ffd77a7222b2560 100644 (file)
@@ -110,13 +110,13 @@ int8in(char *str)
 
 #if HAVE_64BIT_INTS
        if (!PointerIsValid(str))
-               elog(WARN, "Bad (null) int8 external representation", NULL);
+               elog(ERROR, "Bad (null) int8 external representation", NULL);
 
        if (sscanf(str, INT64_FORMAT, result) != 1)
-               elog(WARN, "Bad int8 external representation '%s'", str);
+               elog(ERROR, "Bad int8 external representation '%s'", str);
 
 #else
-       elog(WARN, "64-bit integers are not supported", NULL);
+       elog(ERROR, "64-bit integers are not supported", NULL);
        result = NULL;
 #endif
 
@@ -139,14 +139,14 @@ int8out(int64 * val)
                return (NULL);
 
        if ((len = snprintf(buf, MAXINT8LEN, INT64_FORMAT, *val)) < 0)
-               elog(WARN, "Unable to format int8", NULL);
+               elog(ERROR, "Unable to format int8", NULL);
 
        result = PALLOC(len + 1);
 
        strcpy(result, buf);
 
 #else
-       elog(WARN, "64-bit integers are not supported", NULL);
+       elog(ERROR, "64-bit integers are not supported", NULL);
        result = NULL;
 #endif
 
@@ -328,10 +328,10 @@ int84(int64 * val)
        int32           result;
 
        if (!PointerIsValid(val))
-               elog(WARN, "Invalid (null) int64, can't convert int8 to int4", NULL);
+               elog(ERROR, "Invalid (null) int64, can't convert int8 to int4", NULL);
 
        if ((*val < INT_MIN) || (*val > INT_MAX))
-               elog(WARN, "int8 conversion to int4 is out of range", NULL);
+               elog(ERROR, "int8 conversion to int4 is out of range", NULL);
 
        result = *val;
 
@@ -345,7 +345,7 @@ int28               (int16 val)
        int64      *result;
 
        if (!PointerIsValid(result = PALLOCTYPE(int64)))
-               elog(WARN, "Memory allocation failed, can't convert int8 to int2", NULL);
+               elog(ERROR, "Memory allocation failed, can't convert int8 to int2", NULL);
 
        *result = val;
 
@@ -358,7 +358,7 @@ int82(int64 * val)
        int16           result;
 
        if (!PointerIsValid(val))
-               elog(WARN, "Invalid (null) int8, can't convert to int2", NULL);
+               elog(ERROR, "Invalid (null) int8, can't convert to int2", NULL);
 
        result = *val;
 
@@ -383,7 +383,7 @@ dtoi8(float64 val)
        int64      *result = PALLOCTYPE(int64);
 
        if ((*val < (-pow(2, 64) + 1)) || (*val > (pow(2, 64) - 1)))
-               elog(WARN, "Floating point conversion to int64 is out of range", NULL);
+               elog(ERROR, "Floating point conversion to int64 is out of range", NULL);
 
        *result = *val;
 
index 2aceea60fa09917d9d22b6a6bdc69e60c0316a89..57ad37dbf45982ccf22c3a53b0063df224e9bb51 100644 (file)
@@ -23,18 +23,18 @@ autoinc()
        int                     i;
 
        if (!CurrentTriggerData)
-               elog(WARN, "autoinc: triggers are not initialized");
+               elog(ERROR, "autoinc: triggers are not initialized");
        if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
-               elog(WARN, "autoinc: can't process STATEMENT events");
+               elog(ERROR, "autoinc: can't process STATEMENT events");
        if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
-               elog(WARN, "autoinc: must be fired before event");
+               elog(ERROR, "autoinc: must be fired before event");
        
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
                rettuple = CurrentTriggerData->tg_trigtuple;
        else if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
                rettuple = CurrentTriggerData->tg_newtuple;
        else
-               elog(WARN, "autoinc: can't process DELETE events");
+               elog(ERROR, "autoinc: can't process DELETE events");
        
        rel = CurrentTriggerData->tg_relation;
        relname = SPI_getrelname(rel);
@@ -43,7 +43,7 @@ autoinc()
 
        nargs = trigger->tgnargs;
        if (nargs <= 0 || nargs % 2 != 0)
-               elog(WARN, "autoinc (%s): even number gt 0 of arguments was expected", relname);
+               elog(ERROR, "autoinc (%s): even number gt 0 of arguments was expected", relname);
        
        args = trigger->tgargs;
        tupdesc = rel->rd_att;
@@ -60,9 +60,9 @@ autoinc()
                int32                           val;
                
                if ( attnum < 0 )
-                       elog(WARN, "autoinc (%s): there is no attribute %s", relname, args[i]);
+                       elog(ERROR, "autoinc (%s): there is no attribute %s", relname, args[i]);
                if (SPI_gettypeid (tupdesc, attnum) != INT4OID)
-                       elog(WARN, "autoinc (%s): attribute %s must be of INT4 type", 
+                       elog(ERROR, "autoinc (%s): attribute %s must be of INT4 type", 
                                        relname, args[i]);
                
                val = DatumGetInt32 (SPI_getbinval (rettuple, tupdesc, attnum, &isnull));
@@ -88,7 +88,7 @@ autoinc()
        {
                rettuple = SPI_modifytuple (rel, rettuple, chnattrs, chattrs, newvals, NULL);
                if ( rettuple == NULL )
-                       elog (WARN, "autoinc (%s): %d returned by SPI_modifytuple",
+                       elog (ERROR, "autoinc (%s): %d returned by SPI_modifytuple",
                                relname, SPI_result);
        }
        
index 92889c9348733f33cf5cf4c16d82a89ebc9e490b..cd0fdfc0bba114298955fd119e6e74dfd178bc11 100644 (file)
@@ -27,18 +27,18 @@ insert_username ()
 
                                /* sanity checks from autoinc.c */              
        if (!CurrentTriggerData)
-               elog(WARN, "insert_username: triggers are not initialized");
+               elog(ERROR, "insert_username: triggers are not initialized");
        if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
-               elog(WARN, "insert_username: can't process STATEMENT events");
+               elog(ERROR, "insert_username: can't process STATEMENT events");
        if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
-               elog(WARN, "insert_username: must be fired before event");
+               elog(ERROR, "insert_username: must be fired before event");
        
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
                rettuple = CurrentTriggerData->tg_trigtuple;
        else if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
                rettuple = CurrentTriggerData->tg_newtuple;
        else
-               elog(WARN, "insert_username: can't process DELETE events");
+               elog(ERROR, "insert_username: can't process DELETE events");
        
        rel = CurrentTriggerData->tg_relation;
        relname = SPI_getrelname(rel);
@@ -47,7 +47,7 @@ insert_username ()
 
        nargs = trigger->tgnargs;
        if (nargs != 1)
-               elog(WARN, "insert_username (%s): one argument was expected", relname);
+               elog(ERROR, "insert_username (%s): one argument was expected", relname);
        
        args = trigger->tgargs;
        tupdesc = rel->rd_att;
@@ -57,9 +57,9 @@ insert_username ()
        attnum = SPI_fnumber (tupdesc, args[0]);
                
        if ( attnum < 0 )
-               elog(WARN, "insert_username (%s): there is no attribute %s", relname, args[0]);
+               elog(ERROR, "insert_username (%s): there is no attribute %s", relname, args[0]);
        if (SPI_gettypeid (tupdesc, attnum) != TEXTOID)
-               elog(WARN, "insert_username (%s): attribute %s must be of TEXT type", 
+               elog(ERROR, "insert_username (%s): attribute %s must be of TEXT type", 
                                relname, args[0]);
 
                                /* create fields containing name */
@@ -68,7 +68,7 @@ insert_username ()
                                /* construct new tuple */
        rettuple = SPI_modifytuple (rel, rettuple, 1, &attnum, &newval, NULL);
        if ( rettuple == NULL )
-               elog (WARN, "insert_username (%s): %d returned by SPI_modifytuple",
+               elog (ERROR, "insert_username (%s): %d returned by SPI_modifytuple",
                        relname, SPI_result);
        
        pfree (relname);
index 36f451308bb82339b500b548710461c1a2259d27..f457a53ac601262ea4c33208aeab959be2828f56 100644 (file)
@@ -60,11 +60,11 @@ check_primary_key()
 
        /* Called by trigger manager ? */
        if (!CurrentTriggerData)
-               elog(WARN, "check_primary_key: triggers are not initialized");
+               elog(ERROR, "check_primary_key: triggers are not initialized");
 
        /* Should be called for ROW trigger */
        if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
-               elog(WARN, "check_primary_key: can't process STATEMENT events");
+               elog(ERROR, "check_primary_key: can't process STATEMENT events");
 
        /* If INSERTion then must check Tuple to being inserted */
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
@@ -74,7 +74,7 @@ check_primary_key()
        /* Not should be called for DELETE */
        else if (TRIGGER_FIRED_BY_DELETE(CurrentTriggerData->tg_event))
 
-               elog(WARN, "check_primary_key: can't process DELETE events");
+               elog(ERROR, "check_primary_key: can't process DELETE events");
 
        /* If UPDATion the must check new Tuple, not old one */
        else
@@ -85,7 +85,7 @@ check_primary_key()
        args = trigger->tgargs;
 
        if (nargs % 2 != 1)                     /* odd number of arguments! */
-               elog(WARN, "check_primary_key: odd number of arguments should be specified");
+               elog(ERROR, "check_primary_key: odd number of arguments should be specified");
 
        nkeys = nargs / 2;
        relname = args[nkeys];
@@ -101,7 +101,7 @@ check_primary_key()
 
        /* Connect to SPI manager */
        if ((ret = SPI_connect()) < 0)
-               elog(WARN, "check_primary_key: SPI_connect returned %d", ret);
+               elog(ERROR, "check_primary_key: SPI_connect returned %d", ret);
 
        /*
         * We use SPI plan preparation feature, so allocate space to place key
@@ -128,7 +128,7 @@ check_primary_key()
 
                /* Bad guys may give us un-existing column in CREATE TRIGGER */
                if (fnumber < 0)
-                       elog(WARN, "check_primary_key: there is no attribute %s in relation %s",
+                       elog(ERROR, "check_primary_key: there is no attribute %s in relation %s",
                                 args[i], SPI_getrelname(rel));
 
                /* Well, get binary (in internal format) value of column */
@@ -171,7 +171,7 @@ check_primary_key()
                /* Prepare plan for query */
                pplan = SPI_prepare(sql, nkeys, argtypes);
                if (pplan == NULL)
-                       elog(WARN, "check_primary_key: SPI_prepare returned %d", SPI_result);
+                       elog(ERROR, "check_primary_key: SPI_prepare returned %d", SPI_result);
 
                /*
                 * Remember that SPI_prepare places plan in current memory context
@@ -180,7 +180,7 @@ check_primary_key()
                 */
                pplan = SPI_saveplan(pplan);
                if (pplan == NULL)
-                       elog(WARN, "check_primary_key: SPI_saveplan returned %d", SPI_result);
+                       elog(ERROR, "check_primary_key: SPI_saveplan returned %d", SPI_result);
                plan->splan = (void **) malloc(sizeof(void *));
                *(plan->splan) = pplan;
                plan->nplans = 1;
@@ -193,13 +193,13 @@ check_primary_key()
                /* we have no NULLs - so we pass   ^^^^   here */
 
        if (ret < 0)
-               elog(WARN, "check_primary_key: SPI_execp returned %d", ret);
+               elog(ERROR, "check_primary_key: SPI_execp returned %d", ret);
 
        /*
         * If there are no tuples returned by SELECT then ...
         */
        if (SPI_processed == 0)
-               elog(WARN, "%s: tuple references non-existing key in %s",
+               elog(ERROR, "%s: tuple references non-existing key in %s",
                         trigger->tgname, relname);
 
        SPI_finish();
@@ -250,16 +250,16 @@ check_foreign_key()
 
        /* Called by trigger manager ? */
        if (!CurrentTriggerData)
-               elog(WARN, "check_foreign_key: triggers are not initialized");
+               elog(ERROR, "check_foreign_key: triggers are not initialized");
 
        /* Should be called for ROW trigger */
        if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
-               elog(WARN, "check_foreign_key: can't process STATEMENT events");
+               elog(ERROR, "check_foreign_key: can't process STATEMENT events");
 
        /* Not should be called for INSERT */
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
 
-               elog(WARN, "check_foreign_key: can't process INSERT events");
+               elog(ERROR, "check_foreign_key: can't process INSERT events");
 
        /* Have to check tg_trigtuple - tuple being deleted */
        trigtuple = CurrentTriggerData->tg_trigtuple;
@@ -278,18 +278,18 @@ check_foreign_key()
 
        if (nargs < 5)                          /* nrefs, action, key, Relation, key - at
                                                                 * least */
-               elog(WARN, "check_foreign_key: too short %d (< 5) list of arguments", nargs);
+               elog(ERROR, "check_foreign_key: too short %d (< 5) list of arguments", nargs);
        nrefs = pg_atoi(args[0], sizeof(int), 0);
        if (nrefs < 1)
-               elog(WARN, "check_foreign_key: %d (< 1) number of references specified", nrefs);
+               elog(ERROR, "check_foreign_key: %d (< 1) number of references specified", nrefs);
        action = tolower(*(args[1]));
        if (action != 'r' && action != 'c' && action != 's')
-               elog(WARN, "check_foreign_key: invalid action %s", args[1]);
+               elog(ERROR, "check_foreign_key: invalid action %s", args[1]);
        nargs -= 2;
        args += 2;
        nkeys = (nargs - nrefs) / (nrefs + 1);
        if (nkeys <= 0 || nargs != (nrefs + nkeys * (nrefs + 1)))
-               elog(WARN, "check_foreign_key: invalid number of arguments %d for %d references",
+               elog(ERROR, "check_foreign_key: invalid number of arguments %d for %d references",
                         nargs + 2, nrefs);
 
        rel = CurrentTriggerData->tg_relation;
@@ -304,7 +304,7 @@ check_foreign_key()
 
        /* Connect to SPI manager */
        if ((ret = SPI_connect()) < 0)
-               elog(WARN, "check_foreign_key: SPI_connect returned %d", ret);
+               elog(ERROR, "check_foreign_key: SPI_connect returned %d", ret);
 
        /*
         * We use SPI plan preparation feature, so allocate space to place key
@@ -327,7 +327,7 @@ check_foreign_key()
         * else - check that we have exactly nrefs plan(s) ready
         */
        else if (plan->nplans != nrefs)
-               elog(WARN, "%s: check_foreign_key: # of plans changed in meantime",
+               elog(ERROR, "%s: check_foreign_key: # of plans changed in meantime",
                         trigger->tgname);
 
        /* For each column in key ... */
@@ -338,7 +338,7 @@ check_foreign_key()
 
                /* Bad guys may give us un-existing column in CREATE TRIGGER */
                if (fnumber < 0)
-                       elog(WARN, "check_foreign_key: there is no attribute %s in relation %s",
+                       elog(ERROR, "check_foreign_key: there is no attribute %s in relation %s",
                                 args[i], SPI_getrelname(rel));
 
                /* Well, get binary (in internal format) value of column */
@@ -367,7 +367,7 @@ check_foreign_key()
 
                        /* this shouldn't happen! SPI_ERROR_NOOUTFUNC ? */
                        if (oldval == NULL)
-                               elog(WARN, "check_foreign_key: SPI_getvalue returned %d", SPI_result);
+                               elog(ERROR, "check_foreign_key: SPI_getvalue returned %d", SPI_result);
                        newval = SPI_getvalue(newtuple, tupdesc, fnumber);
                        if (newval == NULL || strcmp(oldval, newval) != 0)
                                isequal = false;
@@ -439,7 +439,7 @@ check_foreign_key()
                        /* Prepare plan for query */
                        pplan = SPI_prepare(sql, nkeys, argtypes);
                        if (pplan == NULL)
-                               elog(WARN, "check_foreign_key: SPI_prepare returned %d", SPI_result);
+                               elog(ERROR, "check_foreign_key: SPI_prepare returned %d", SPI_result);
 
                        /*
                         * Remember that SPI_prepare places plan in current memory
@@ -448,7 +448,7 @@ check_foreign_key()
                         */
                        pplan = SPI_saveplan(pplan);
                        if (pplan == NULL)
-                               elog(WARN, "check_foreign_key: SPI_saveplan returned %d", SPI_result);
+                               elog(ERROR, "check_foreign_key: SPI_saveplan returned %d", SPI_result);
 
                        plan->splan[r] = pplan;
 
@@ -484,14 +484,14 @@ check_foreign_key()
                        /* we have no NULLs - so we pass   ^^^^  here */
 
                if (ret < 0)
-                       elog(WARN, "check_foreign_key: SPI_execp returned %d", ret);
+                       elog(ERROR, "check_foreign_key: SPI_execp returned %d", ret);
 
                /* If action is 'R'estrict ... */
                if (action == 'r')
                {
                        /* If there is tuple returned by SELECT then ... */
                        if (SPI_processed > 0)
-                               elog(WARN, "%s: tuple referenced in %s",
+                               elog(ERROR, "%s: tuple referenced in %s",
                                         trigger->tgname, relname);
                }
 #ifdef REFINT_VERBOSE
index db30e6f6d96c5b758c918a8d905f143a0bd24e4f..270095acbffdfb3b9fa95bc8dbb576d336505fb6 100644 (file)
@@ -77,15 +77,15 @@ timetravel()
 
        /* Called by trigger manager ? */
        if (!CurrentTriggerData)
-               elog(WARN, "timetravel: triggers are not initialized");
+               elog(ERROR, "timetravel: triggers are not initialized");
        
        /* Should be called for ROW trigger */
        if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
-               elog(WARN, "timetravel: can't process STATEMENT events");
+               elog(ERROR, "timetravel: can't process STATEMENT events");
        
        /* Should be called BEFORE */
        if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
-               elog(WARN, "timetravel: must be fired before event");
+               elog(ERROR, "timetravel: must be fired before event");
 
        /* INSERT ? */
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
@@ -112,7 +112,7 @@ timetravel()
        trigger = CurrentTriggerData->tg_trigger;
 
        if (trigger->tgnargs != 2)
-               elog(WARN, "timetravel (%s): invalid (!= 2) number of arguments %d", 
+               elog(ERROR, "timetravel (%s): invalid (!= 2) number of arguments %d", 
                                relname, trigger->tgnargs);
        
        args = trigger->tgargs;
@@ -130,9 +130,9 @@ timetravel()
        {
                attnum[i] = SPI_fnumber (tupdesc, args[i]);
                if ( attnum[i] < 0 )
-                       elog(WARN, "timetravel (%s): there is no attribute %s", relname, args[i]);
+                       elog(ERROR, "timetravel (%s): there is no attribute %s", relname, args[i]);
                if (SPI_gettypeid (tupdesc, attnum[i]) != ABSTIMEOID)
-                       elog(WARN, "timetravel (%s): attributes %s and %s must be of abstime type", 
+                       elog(ERROR, "timetravel (%s): attributes %s and %s must be of abstime type", 
                                        relname, args[0], args[1]);
        }
        
@@ -155,7 +155,7 @@ timetravel()
                {
                        if ((chnattrs == 0 && DatumGetInt32 (oldon) >= NOEND_ABSTIME) || 
                                (chnattrs > 0 && DatumGetInt32 (newvals[0]) >= NOEND_ABSTIME))
-                               elog (WARN, "timetravel (%s): %s ge %s", 
+                               elog (ERROR, "timetravel (%s): %s ge %s", 
                                                relname, args[0], args[1]);
                        newvals[chnattrs] = NOEND_ABSTIME;
                        chattrs[chnattrs] = attnum[1];
@@ -167,7 +167,7 @@ timetravel()
                                                                                DatumGetInt32 (oldoff)) || 
                                (chnattrs > 0 && DatumGetInt32 (newvals[0]) >= 
                                                                                DatumGetInt32 (oldoff)))
-                               elog (WARN, "timetravel (%s): %s ge %s", 
+                               elog (ERROR, "timetravel (%s): %s ge %s", 
                                                relname, args[0], args[1]);
                }
                
@@ -182,11 +182,11 @@ timetravel()
        
        oldon = SPI_getbinval (trigtuple, tupdesc, attnum[0], &isnull);
        if (isnull)
-               elog(WARN, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
+               elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
        
        oldoff = SPI_getbinval (trigtuple, tupdesc, attnum[1], &isnull);
        if (isnull)
-               elog(WARN, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
+               elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
        /*
         * If DELETE/UPDATE of tuple with stop_date neq INFINITY
         * then say upper Executor to skip operation for this tuple
@@ -195,13 +195,13 @@ timetravel()
        {
                newon = SPI_getbinval (newtuple, tupdesc, attnum[0], &isnull);
                if (isnull)
-                       elog(WARN, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
+                       elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
                newoff = SPI_getbinval (newtuple, tupdesc, attnum[1], &isnull);
                if (isnull)
-                       elog(WARN, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
+                       elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
                
                if ( oldon != newon || oldoff != newoff )
-                       elog (WARN, "timetravel (%s): you can't change %s and/or %s columns (use set_timetravel)",
+                       elog (ERROR, "timetravel (%s): you can't change %s and/or %s columns (use set_timetravel)",
                                        relname, args[0], args[1]);
                
                if ( newoff != NOEND_ABSTIME )
@@ -220,7 +220,7 @@ timetravel()
        
        /* Connect to SPI manager */
        if ((ret = SPI_connect()) < 0)
-               elog(WARN, "timetravel (%s): SPI_connect returned %d", relname, ret);
+               elog(ERROR, "timetravel (%s): SPI_connect returned %d", relname, ret);
        
        /* Fetch tuple values and nulls */
        cvals = (Datum *) palloc (natts * sizeof (Datum));
@@ -278,7 +278,7 @@ timetravel()
                /* Prepare plan for query */
                pplan = SPI_prepare(sql, natts, ctypes);
                if (pplan == NULL)
-                       elog(WARN, "timetravel (%s): SPI_prepare returned %d", relname, SPI_result);
+                       elog(ERROR, "timetravel (%s): SPI_prepare returned %d", relname, SPI_result);
                
                /*
                 * Remember that SPI_prepare places plan in current memory context
@@ -287,7 +287,7 @@ timetravel()
                 */
                pplan = SPI_saveplan(pplan);
                if (pplan == NULL)
-                       elog(WARN, "timetravel (%s): SPI_saveplan returned %d", relname, SPI_result);
+                       elog(ERROR, "timetravel (%s): SPI_saveplan returned %d", relname, SPI_result);
                
                plan->splan = pplan;
        }
@@ -298,7 +298,7 @@ timetravel()
        ret = SPI_execp(plan->splan, cvals, cnulls, 0);
        
        if (ret < 0)
-               elog(WARN, "timetravel (%s): SPI_execp returned %d", relname, ret);
+               elog(ERROR, "timetravel (%s): SPI_execp returned %d", relname, ret);
        
        /* Tuple to return to upper Executor ... */
        if (newtuple)                                                                   /* UPDATE */
index d9340f2544e7e7b60150b74d403f0c91acbd1fd8..2c86b7826ed677443aa5b21cded51dc53be20393 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.11 1998/01/05 03:30:16 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.12 1998/01/06 18:51:55 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,10 +79,10 @@ static Oid objectid;
        int                     ival;
 }
 
-%type <list>  arg_list
-%type <ielem> index_params index_on
-%type <ival> const ident
-%type <ival> optbootstrap optoideq tuple tuplelist
+%type <list>  boot_arg_list
+%type <ielem> boot_index_params boot_index_on
+%type <ival> boot_const boot_ident
+%type <ival> optbootstrap optoideq boot_tuple boot_tuplelist
 
 %token <ival> CONST ID
 %token OPEN XCLOSE XCREATE INSERT_TUPLE
@@ -98,26 +98,26 @@ static Oid objectid;
 %%
 
 TopLevel:
-                 Queries
+                 Boot_Queries
                |
                ;
 
-Queries:
-                 A_Query
-               | Queries A_Query
+Boot_Queries:
+                 Boot_Query
+               | Boot_Queries Boot_Query
                ;
 
-A_Query :
-                 OpenStmt
-               | CloseStmt
-               | CreateStmt
-               | InsertStmt
-               | DeclareIndexStmt
-               | BuildIndsStmt
+Boot_Query :
+                 Boot_OpenStmt
+               | Boot_CloseStmt
+               | Boot_CreateStmt
+               | Boot_InsertStmt
+               | Boot_DeclareIndexStmt
+               | Boot_BuildIndsStmt
                ;
 
-OpenStmt:
-                 OPEN ident
+Boot_OpenStmt:
+                 OPEN boot_ident
                                {
                                        DO_START;
                                        boot_openrel(LexIDStr($2));
@@ -125,8 +125,8 @@ OpenStmt:
                                }
                ;
 
-CloseStmt:
-                 XCLOSE ident %prec low
+Boot_CloseStmt:
+                 XCLOSE boot_ident %prec low
                                {
                                        DO_START;
                                        closerel(LexIDStr($2));
@@ -140,13 +140,13 @@ CloseStmt:
                                }
                ;
 
-CreateStmt:
-                 XCREATE optbootstrap ident LPAREN
+Boot_CreateStmt:
+                 XCREATE optbootstrap boot_ident LPAREN
                                {
                                        DO_START;
                                        numattr=(int)0;
                                }
-                 typelist
+                 boot_typelist
                                {
                                        if (!Quiet)
                                                putchar('\n');
@@ -192,7 +192,7 @@ CreateStmt:
                                }
                ;
 
-InsertStmt:
+Boot_InsertStmt:
                  INSERT_TUPLE optoideq
                                {
                                        DO_START;
@@ -200,7 +200,7 @@ InsertStmt:
                                                printf("tuple %d<", $2);
                                        num_tuples_read = 0;
                                }
-                 LPAREN  tuplelist RPAREN
+                 LPAREN  boot_tuplelist RPAREN
                                {
                                        if (num_tuples_read != numattr)
                                                elog(ABORT,"incorrect number of values for tuple");
@@ -223,8 +223,8 @@ InsertStmt:
                                }
                ;
 
-DeclareIndexStmt:
-                 XDECLARE INDEX ident ON ident USING ident LPAREN index_params RPAREN
+Boot_DeclareIndexStmt:
+                 XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
                                {
                                        List *params;
 
@@ -239,25 +239,25 @@ DeclareIndexStmt:
                                }
                ;
 
-BuildIndsStmt:
+Boot_BuildIndsStmt:
                  XBUILD INDICES                { build_indices(); }
 
-index_params:
-               index_on ident
+boot_index_params:
+               boot_index_on boot_ident
                                {
                                        IndexElem *n = (IndexElem*)$1;
                                        n->class = LexIDStr($2);
                                        $$ = n;
                                }
 
-index_on:
-                 ident
+boot_index_on:
+                 boot_ident
                                {
                                        IndexElem *n = makeNode(IndexElem);
                                        n->name = LexIDStr($1);
                                        $$ = n;
                                }
-               | ident LPAREN arg_list RPAREN
+               | boot_ident LPAREN boot_arg_list RPAREN
                                {
                                        IndexElem *n = makeNode(IndexElem);
                                        n->name = LexIDStr($1);
@@ -265,12 +265,12 @@ index_on:
                                        $$ = n;
                                }
 
-arg_list:
-                 ident
+boot_arg_list:
+                 boot_ident
                                {
                                        $$ = lappend(NIL, makeString(LexIDStr($1)));
                                }
-               | arg_list COMMA ident
+               | boot_arg_list COMMA boot_ident
                                {
                                        $$ = lappend((List*)$1, makeString(LexIDStr($3)));
                                }
@@ -280,13 +280,13 @@ optbootstrap:
                |                               { $$ = 0; }
                ;
 
-typelist:
-                 typething
-               | typelist COMMA typething
+boot_typelist:
+                 boot_type_thing
+               | boot_typelist COMMA boot_type_thing
                ;
 
-typething:
-                 ident EQUALS ident
+boot_type_thing:
+                 boot_ident EQUALS boot_ident
                                {
                                   if(++numattr > MAXATTR)
                                                elog(FATAL,"Too many attributes\n");
@@ -297,28 +297,28 @@ typething:
                ;
 
 optoideq:
-                       OBJ_ID EQUALS ident { $$ = atol(LexIDStr($3));                          }
+                       OBJ_ID EQUALS boot_ident { $$ = atol(LexIDStr($3));                             }
                |                                               { extern Oid newoid(); $$ = newoid();   }
                ;
 
-tuplelist:
-                  tuple
-               |  tuplelist tuple
-               |  tuplelist COMMA tuple
+boot_tuplelist:
+                  boot_tuple
+               |  boot_tuplelist boot_tuple
+               |  boot_tuplelist COMMA boot_tuple
                ;
 
-tuple:
-                 ident {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
-               | const {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
+boot_tuple:
+                 boot_ident {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
+               | boot_const {InsertOneValue(objectid, LexIDStr($1), num_tuples_read++); }
                | NULLVAL
                        { InsertOneNull(num_tuples_read++); }
                ;
 
-const :
+boot_const :
                  CONST { $$=yylval.ival; }
                ;
 
-ident :
+boot_ident :
                  ID    { $$=yylval.ival; }
                ;
 %%
index 752399e7615dd558a9d764304153ac50a8544107..e7545632864c4e99f692a3e87374aecb9b6f70de 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.1 1998/01/05 18:42:40 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.2 1998/01/06 18:52:03 momjian Exp $
  *
  * NOTES
  *       See acl.h.
@@ -410,7 +410,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
                 * pg_database table, there is still additional permissions
                 * checking in dbcommands.c
                 */
-               if (mode & ACL_AP)
+               if ((mode & ACL_WR) || (mode & ACL_AP))
                        return ACLCHECK_OK;
        }
 
index 5a241953da3a8159e14c1a7f807bbce6559b81d9..72d8ce59d4807534b0dcf91a2843169e9fda9dd4 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.6 1998/01/05 03:31:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.7 1998/01/06 18:52:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,7 +76,9 @@ appendStringInfo(StringInfo str, char *buffer)
                                newlen;
        char       *s;
 
-       Assert((str != NULL));
+       Assert(str != NULL);
+       if (buffer == NULL)
+               buffer = "\"\"";
 
        /*
         * do we have enough space to append the new string? (don't forget to
index a7fa85d31f821bb87f133899dbb9ee82bc3b7557..7232d5a026aa573fb20ccb4a3f6a4dab7f21eb21 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.14 1997/12/27 06:40:54 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.15 1998/01/06 18:52:15 momjian Exp $
  *
  * NOTES
  *       Every (plan) node in POSTGRES has an associated "out" routine which
@@ -70,63 +70,71 @@ _outIntList(StringInfo str, List *list)
 static void
 _outCreateStmt(StringInfo str, CreateStmt *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "CREATE");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "CREATE");
 
-       sprintf(buf, " :relname %s", node->relname);
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :relname ");
+       appendStringInfo(str, node->relname);
        appendStringInfo(str, " :columns");
        _outNode(str, node->tableElts);
+       appendStringInfo(str, " :inhRelnames");
+       _outNode(str, node->inhRelnames);
+       appendStringInfo(str, " :constraints");
+       _outNode(str, node->constraints);
 } /* _outCreateStmt() */
 
 static void
 _outIndexStmt(StringInfo str, IndexStmt *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "INDEX");
-       appendStringInfo(str, buf);
-
-       sprintf(buf, " :idxname %s", node->idxname);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :relname %s", node->relname);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :method %s", node->accessMethod);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :unique %s", (node->unique? "y": "n"));
-       appendStringInfo(str, buf);
-       appendStringInfo(str, " :columns");
+       appendStringInfo(str, "INDEX");
+
+       appendStringInfo(str, " :idxname ");
+       appendStringInfo(str, node->idxname);
+       appendStringInfo(str, " :relname ");
+       appendStringInfo(str, node->relname);
+       appendStringInfo(str, " :accessMethod ");
+       appendStringInfo(str, node->accessMethod);
+       appendStringInfo(str, " :indexParams ");
        _outNode(str, node->indexParams);
+       appendStringInfo(str, " :withClause ");
+       _outNode(str, node->withClause);
+       appendStringInfo(str, " :whereClause ");
+       _outNode(str, node->whereClause);
+       appendStringInfo(str, " :rangetable ");
+       _outNode(str, node->rangetable);
+       appendStringInfo(str, " :lossy ");
+       appendStringInfo(str, (*node->lossy ? "y": "n"));
+       appendStringInfo(str, " :unique ");
+       appendStringInfo(str, (node->unique ? "y": "n"));
 } /* _outIndexStmt() */
 
 static void
 _outColumnDef(StringInfo str, ColumnDef *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "COLUMNDEF");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "COLUMNDEF");
 
-       sprintf(buf, " :colname %s", node->colname);
-       appendStringInfo(str, buf);
-       appendStringInfo(str, " :typename");
+       appendStringInfo(str, " :colname ");
+       appendStringInfo(str, node->colname);
+       appendStringInfo(str, " :typename ");
        _outNode(str, node->typename);
+       appendStringInfo(str, " :is_not_null ");
+       appendStringInfo(str, (node->is_not_null ? "y": "n"));
+       appendStringInfo(str, " :defval ");
+       appendStringInfo(str, node->defval);
+       appendStringInfo(str, " :constraints");
+       _outNode(str, node->constraints);
 } /* _outColumnDef() */
 
 static void
 _outIndexElem(StringInfo str, IndexElem *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "INDEXELEM");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "INDEXELEM");
 
-       sprintf(buf, " :name %s", node->name);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :class %s", node->class);
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :name ");
+       appendStringInfo(str, node->name);
+       appendStringInfo(str, " :args ");
+       _outNode(str, node->args);
+       appendStringInfo(str, " :class ");
+       appendStringInfo(str, node->class);
        appendStringInfo(str, " :tname");
        _outNode(str, node->tname);
 } /* _outIndexElem() */
@@ -135,66 +143,98 @@ static void
 _outQuery(StringInfo str, Query *node)
 {
        char            buf[500];
+       int i;
+       
+       appendStringInfo(str, "QUERY");
 
-       sprintf(buf, "QUERY");
+       appendStringInfo(str, " :command ");
+       sprintf(buf," %d ", node->commandType);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :command %d", node->commandType);
-       appendStringInfo(str, buf);
        if (node->utilityStmt)
        {
                switch (nodeTag(node->utilityStmt))
                {
                        case T_CreateStmt:
-                               sprintf(buf, " :create %s",
-                                       ((CreateStmt *) (node->utilityStmt))->relname);
-                               appendStringInfo(str, buf);
+                               appendStringInfo(str, " :create ");
+                               appendStringInfo(str, ((CreateStmt *) (node->utilityStmt))->relname);
                                _outNode(str, node->utilityStmt);
                                break;
 
                        case T_IndexStmt:
-                               sprintf(buf, " :index %s on %s",
-                                       ((IndexStmt *) (node->utilityStmt))->idxname,
-                                       ((IndexStmt *) (node->utilityStmt))->relname);
-                               appendStringInfo(str, buf);
+                               appendStringInfo(str, " :index ");
+                               appendStringInfo(str, ((IndexStmt *) (node->utilityStmt))->idxname);
+                               appendStringInfo(str, " on ");
+                               appendStringInfo(str, ((IndexStmt *) (node->utilityStmt))->relname);
                                _outNode(str, node->utilityStmt);
                                break;
 
                        case T_NotifyStmt:
-                               sprintf(buf, " :utility %s",
-                                       ((NotifyStmt *) (node->utilityStmt))->relname);
-                               appendStringInfo(str, buf);
+                               appendStringInfo(str, " :utility ");
+                               appendStringInfo(str, ((NotifyStmt *) (node->utilityStmt))->relname);
                                break;
 
                        default:
-                               sprintf(buf, " :utility ?");
-                               appendStringInfo(str, buf);
+                               appendStringInfo(str, " :utility ? ");
                }
        }
        else
        {
-/* use "" to designate */
-               appendStringInfo(str, " :utility \"\"");
+               appendStringInfo(str, " :utility ");
+               appendStringInfo(str, NULL);
        }
 
-       sprintf(buf, " :resrel %d", node->resultRelation);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :rtable ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :resultRelation ");
+       sprintf(buf, " %d ", node->resultRelation);
+       appendStringInfo(str, buf);
+       appendStringInfo(str, " :into ");
+       appendStringInfo(str, node->into);
+       appendStringInfo(str, " :isPortal ");
+       appendStringInfo(str, (node->isPortal ? "y": "n"));
+       appendStringInfo(str, " :isBinary ");
+       appendStringInfo(str, (node->isBinary ? "y": "n"));
+       appendStringInfo(str, " :unionall ");
+       appendStringInfo(str, (node->unionall ? "y": "n"));
+       appendStringInfo(str, " :unique ");
+       appendStringInfo(str, node->uniqueFlag);
+       appendStringInfo(str, " :sortClause ");
+       _outNode(str, node->sortClause);
+       appendStringInfo(str, " :rtable ");
        _outNode(str, node->rtable);
-       if (node->uniqueFlag)
-               sprintf(buf, " :unique %s", node->uniqueFlag);
-       else
-/* use "" to designate non-unique */
-               sprintf(buf, " :unique \"\"");
-       appendStringInfo(str, buf);
-       sprintf(buf, " :targetlist ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :targetlist ");
        _outNode(str, node->targetList);
-       sprintf(buf, " :qual ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :qual ");
        _outNode(str, node->qual);
-       /* how are we handling aggregates, sort, and group by? bjm 1997/12/26 */
+       appendStringInfo(str, " :groupClause ");
+       _outNode(str, node->groupClause);
+       appendStringInfo(str, " :havingQual ");
+       _outNode(str, node->havingQual);
+       appendStringInfo(str, " :qry_numAgg ");
+       sprintf(buf, " %d ", node->qry_numAgg);
+       appendStringInfo(str, buf);
+       appendStringInfo(str, " :qry_aggs ");
+       for (i=0; i < node->qry_numAgg; i++)
+               _outNode(str, node->qry_aggs[i]);
+       appendStringInfo(str, " :unionClause ");
+       _outNode(str, node->unionClause);
+}
+
+static void
+_outSortGroupBy(StringInfo str, SortGroupBy *node)
+{
+       char            buf[500];
+       int i;
+       
+       appendStringInfo(str, "SORTGROUPBY");
+
+       appendStringInfo(str, " :resno ");
+       sprintf(buf," %d ", node->resno);
+       appendStringInfo(str, " :range ");
+       appendStringInfo(str, node->range);
+       appendStringInfo(str, " :name ");
+       appendStringInfo(str, node->name);
+       appendStringInfo(str, " :useOp ");
+       appendStringInfo(str, node->useOp);
 }
 
 /*
@@ -211,20 +251,15 @@ _outPlanInfo(StringInfo str, Plan *node)
        appendStringInfo(str, buf);
        sprintf(buf, " :width %d", node->plan_width);
        appendStringInfo(str, buf);
-       sprintf(buf, " :state %s", (node->state == (EState *) NULL ?
-                                                               "nil" : "non-NIL"));
-       appendStringInfo(str, buf);
-       sprintf(buf, " :qptargetlist ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :state ");
+       appendStringInfo(str,  (node->state == (EState *) NULL? "nil" : "non-NIL"));
+       appendStringInfo(str, " :qptargetlist ");
        _outNode(str, node->targetlist);
-       sprintf(buf, " :qpqual ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :qpqual ");
        _outNode(str, node->qual);
-       sprintf(buf, " :lefttree ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :lefttree ");
        _outNode(str, node->lefttree);
-       sprintf(buf, " :righttree ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :righttree ");
        _outNode(str, node->righttree);
 
 }
@@ -235,25 +270,17 @@ _outPlanInfo(StringInfo str, Plan *node)
 static void
 _outPlan(StringInfo str, Plan *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "PLAN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "PLAN");
        _outPlanInfo(str, (Plan *) node);
-
 }
 
 static void
 _outResult(StringInfo str, Result *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "RESULT");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "RESULT");
        _outPlanInfo(str, (Plan *) node);
 
-       sprintf(buf, " :resconstantqual ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :resconstantqual ");
        _outNode(str, node->resconstantqual);
 
 }
@@ -266,19 +293,19 @@ _outAppend(StringInfo str, Append *node)
 {
        char            buf[500];
 
-       sprintf(buf, "APPEND");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "APPEND");
        _outPlanInfo(str, (Plan *) node);
 
-       sprintf(buf, " :unionplans ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :unionplans ");
        _outNode(str, node->unionplans);
 
+       appendStringInfo(str, " :unionrts ");
+       _outNode(str, node->unionrts);
+
        sprintf(buf, " :unionrelid %d", node->unionrelid);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :unionrtentries ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :unionrtentries ");
        _outNode(str, node->unionrtentries);
 
 }
@@ -289,10 +316,7 @@ _outAppend(StringInfo str, Append *node)
 static void
 _outJoin(StringInfo str, Join *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "JOIN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "JOIN");
        _outPlanInfo(str, (Plan *) node);
 
 }
@@ -303,10 +327,7 @@ _outJoin(StringInfo str, Join *node)
 static void
 _outNestLoop(StringInfo str, NestLoop *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "NESTLOOP");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "NESTLOOP");
        _outPlanInfo(str, (Plan *) node);
 }
 
@@ -318,12 +339,10 @@ _outMergeJoin(StringInfo str, MergeJoin *node)
 {
        char            buf[500];
 
-       sprintf(buf, "MERGEJOIN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "MERGEJOIN");
        _outPlanInfo(str, (Plan *) node);
 
-       sprintf(buf, " :mergeclauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :mergeclauses ");
        _outNode(str, node->mergeclauses);
 
        sprintf(buf, " :mergesortop %u", node->mergesortop);
@@ -344,12 +363,10 @@ _outHashJoin(StringInfo str, HashJoin *node)
 {
        char            buf[500];
 
-       sprintf(buf, "HASHJOIN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "HASHJOIN");
        _outPlanInfo(str, (Plan *) node);
 
-       sprintf(buf, " :hashclauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :hashclauses ");
        _outNode(str, node->hashclauses);
 
        sprintf(buf, " :hashjoinop %u", node->hashjoinop);
@@ -372,8 +389,7 @@ _outScan(StringInfo str, Scan *node)
 {
        char            buf[500];
 
-       sprintf(buf, "SCAN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "SCAN");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :scanrelid %d", node->scanrelid);
@@ -389,8 +405,7 @@ _outSeqScan(StringInfo str, SeqScan *node)
 {
        char            buf[500];
 
-       sprintf(buf, "SEQSCAN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "SEQSCAN");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :scanrelid %d", node->scanrelid);
@@ -407,19 +422,16 @@ _outIndexScan(StringInfo str, IndexScan *node)
 {
        char            buf[500];
 
-       sprintf(buf, "INDEXSCAN");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "INDEXSCAN");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :scanrelid %d", node->scan.scanrelid);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :indxid ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indxid ");
        _outIntList(str, node->indxid);
 
-       sprintf(buf, " :indxqual ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indxqual ");
        _outNode(str, node->indxqual);
 
 }
@@ -432,8 +444,7 @@ _outTemp(StringInfo str, Temp *node)
 {
        char            buf[500];
 
-       sprintf(buf, "TEMP");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "TEMP");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :tempid %u", node->tempid);
@@ -451,8 +462,7 @@ _outSort(StringInfo str, Sort *node)
 {
        char            buf[500];
 
-       sprintf(buf, "SORT");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "SORT");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :tempid %u", node->tempid);
@@ -467,8 +477,7 @@ _outAgg(StringInfo str, Agg *node)
 {
        char            buf[500];
 
-       sprintf(buf, "AGG");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "AGG");
        _outPlanInfo(str, (Plan *) node);
 
        /* the actual Agg fields */
@@ -481,19 +490,18 @@ _outGroup(StringInfo str, Group *node)
 {
        char            buf[500];
 
-       sprintf(buf, "GRP");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "GRP");
        _outPlanInfo(str, (Plan *) node);
 
        /* the actual Group fields */
        sprintf(buf, " :numCols %d ", node->numCols);
        appendStringInfo(str, buf);
-       sprintf(buf, " :tuplePerGroup %s", node->tuplePerGroup ? "true" : "nil");
+       appendStringInfo(str, " :tuplePerGroup ");
+       appendStringInfo(str, node->tuplePerGroup ? "true" : "false");
        appendStringInfo(str, buf);
 }
 
 
-
 /*
  *     For some reason, unique is a subclass of Temp.
  */
@@ -502,8 +510,7 @@ _outUnique(StringInfo str, Unique *node)
 {
        char            buf[500];
 
-       sprintf(buf, "UNIQUE");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "UNIQUE");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :tempid %u", node->tempid);
@@ -522,12 +529,10 @@ _outHash(StringInfo str, Hash *node)
 {
        char            buf[500];
 
-       sprintf(buf, "HASH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "HASH");
        _outPlanInfo(str, (Plan *) node);
 
-       sprintf(buf, " :hashkey ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :hashkey ");
        _outNode(str, node->hashkey);
 
        sprintf(buf, " :hashtable 0x%x", (int) (node->hashtable));
@@ -543,8 +548,7 @@ _outTee(StringInfo str, Tee *node)
 {
        char            buf[500];
 
-       sprintf(buf, "TEE");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "TEE");
        _outPlanInfo(str, (Plan *) node);
 
        sprintf(buf, " :leftParent %X", (int) (node->leftParent));
@@ -552,8 +556,7 @@ _outTee(StringInfo str, Tee *node)
        sprintf(buf, " :rightParent %X", (int) (node->rightParent));
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :rtentries ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :rtentries ");
        _outNode(str, node->rtentries);
 }
 
@@ -574,16 +577,15 @@ _outResdom(StringInfo str, Resdom *node)
 {
        char            buf[500];
 
-       sprintf(buf, "RESDOM");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "RESDOM");
        sprintf(buf, " :resno %hd", node->resno);
        appendStringInfo(str, buf);
        sprintf(buf, " :restype %u", node->restype);
        appendStringInfo(str, buf);
        sprintf(buf, " :reslen %d", node->reslen);
        appendStringInfo(str, buf);
-       sprintf(buf, " :resname \"%s\"",
-                       ((node->resname) ? ((char *) node->resname) : "null"));
+       appendStringInfo(str, " :resname ");
+       appendStringInfo(str, node->resname);
        appendStringInfo(str, buf);
        sprintf(buf, " :reskey %d", node->reskey);
        appendStringInfo(str, buf);
@@ -600,10 +602,9 @@ _outFjoin(StringInfo str, Fjoin *node)
        char            buf[500];
        int                     i;
 
-       sprintf(buf, "FJOIN");
-       appendStringInfo(str, buf);
-       sprintf(buf, " :initialized %s", node->fj_initialized ? "true" : "nil");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "FJOIN");
+       appendStringInfo(str, " :initialized ");
+       appendStringInfo(str, node->fj_initialized ? "true" : "false");
        sprintf(buf, " :nNodes %d", node->fj_nNodes);
        appendStringInfo(str, buf);
 
@@ -617,8 +618,7 @@ _outFjoin(StringInfo str, Fjoin *node)
        appendStringInfo(str, " :alwaysdone ");
        for (i = 0; i < node->fj_nNodes; i++)
        {
-               sprintf(buf, " %s ", ((node->fj_alwaysDone[i]) ? "true" : "nil"));
-               appendStringInfo(str, buf);
+               appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
        }
 }
 
@@ -631,8 +631,7 @@ _outExpr(StringInfo str, Expr *node)
        char            buf[500];
        char       *opstr = NULL;
 
-       sprintf(buf, "EXPR");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "EXPR");
 
        sprintf(buf, " :typeOid %u", node->typeOid);
        appendStringInfo(str, buf);
@@ -654,13 +653,11 @@ _outExpr(StringInfo str, Expr *node)
                        opstr = "not";
                        break;
        }
-       sprintf(buf, " :opType %s", opstr);
-       appendStringInfo(str, buf);
-       sprintf(buf, " :oper ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :opType ");
+       appendStringInfo(str, opstr);
+       appendStringInfo(str, " :oper ");
        _outNode(str, node->oper);
-       sprintf(buf, " :args ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :args ");
        _outNode(str, node->args);
 }
 
@@ -672,8 +669,7 @@ _outVar(StringInfo str, Var *node)
 {
        char            buf[500];
 
-       sprintf(buf, "VAR");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "VAR");
        sprintf(buf, " :varno %d", node->varno);
        appendStringInfo(str, buf);
        sprintf(buf, " :varattno %hd", node->varattno);
@@ -694,28 +690,24 @@ _outConst(StringInfo str, Const *node)
 {
        char            buf[500];
 
-       sprintf(buf, "CONST");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "CONST");
        sprintf(buf, " :consttype %u", node->consttype);
        appendStringInfo(str, buf);
        sprintf(buf, " :constlen %hd", node->constlen);
        appendStringInfo(str, buf);
-       sprintf(buf, " :constisnull %s", (node->constisnull ? "true" : "nil"));
-       appendStringInfo(str, buf);
-       sprintf(buf, " :constvalue ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :constisnull ");
+       appendStringInfo(str, node->constisnull ? "true" : "false");
+       appendStringInfo(str, " :constvalue ");
        if (node->constisnull)
        {
-               sprintf(buf, "NIL ");
-               appendStringInfo(str, buf);
+               appendStringInfo(str, "\"\"");
        }
        else
        {
                _outDatum(str, node->constvalue, node->consttype);
        }
-       sprintf(buf, " :constbyval %s", (node->constbyval ? "true" : "nil"));
-       appendStringInfo(str, buf);
-
+       appendStringInfo(str, " :constbyval ");
+       appendStringInfo(str, node->constbyval ? "true" : "false");
 }
 
 /*
@@ -726,20 +718,20 @@ _outAggreg(StringInfo str, Aggreg *node)
 {
        char            buf[500];
 
-       sprintf(buf, "AGGREG");
-       appendStringInfo(str, buf);
-       sprintf(buf, " :aggname \"%s\"", (char *) node->aggname);
+       appendStringInfo(str, "AGGREG");
+       appendStringInfo(str, " :aggname ");
+       appendStringInfo(str, (char *) node->aggname);
        appendStringInfo(str, buf);
        sprintf(buf, " :basetype %u", node->basetype);
        appendStringInfo(str, buf);
        sprintf(buf, " :aggtype %u", node->aggtype);
        appendStringInfo(str, buf);
+       appendStringInfo(str, " :target ");
+       _outNode(str, node->target);
        sprintf(buf, " :aggno %d", node->aggno);
        appendStringInfo(str, buf);
-
-       sprintf(buf, " :target ");
-       appendStringInfo(str, buf);
-       _outNode(str, node->target);
+       appendStringInfo(str, " :usenulls ");
+       appendStringInfo(str, node->usenulls ? "true" : "false");
 }
 
 /*
@@ -751,8 +743,7 @@ _outArray(StringInfo str, Array *node)
        char            buf[500];
        int                     i;
 
-       sprintf(buf, "ARRAY");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "ARRAY");
        sprintf(buf, " :arrayelemtype %u", node->arrayelemtype);
        appendStringInfo(str, buf);
        sprintf(buf, " :arrayelemlength %d", node->arrayelemlength);
@@ -761,15 +752,13 @@ _outArray(StringInfo str, Array *node)
        appendStringInfo(str, buf);
        sprintf(buf, " :arrayndim %d", node->arrayndim);
        appendStringInfo(str, buf);
-       sprintf(buf, " :arraylow ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :arraylow ");
        for (i = 0; i < node->arrayndim; i++)
        {
                sprintf(buf, "  %d", node->arraylow.indx[i]);
                appendStringInfo(str, buf);
        }
-       sprintf(buf, " :arrayhigh ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :arrayhigh ");
        for (i = 0; i < node->arrayndim; i++)
        {
                sprintf(buf, " %d", node->arrayhigh.indx[i]);
@@ -787,8 +776,7 @@ _outArrayRef(StringInfo str, ArrayRef *node)
 {
        char            buf[500];
 
-       sprintf(buf, "ARRAYREF");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "ARRAYREF");
        sprintf(buf, " :refelemtype %u", node->refelemtype);
        appendStringInfo(str, buf);
        sprintf(buf, " :refattrlength %d", node->refattrlength);
@@ -798,20 +786,16 @@ _outArrayRef(StringInfo str, ArrayRef *node)
        sprintf(buf, " :refelembyval %c", (node->refelembyval) ? 't' : 'f');
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :refupperindex ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :refupperindex ");
        _outNode(str, node->refupperindexpr);
 
-       sprintf(buf, " :reflowerindex ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :reflowerindex ");
        _outNode(str, node->reflowerindexpr);
 
-       sprintf(buf, " :refexpr ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :refexpr ");
        _outNode(str, node->refexpr);
 
-       sprintf(buf, " :refassgnexpr ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :refassgnexpr ");
        _outNode(str, node->refassgnexpr);
 }
 
@@ -823,15 +807,13 @@ _outFunc(StringInfo str, Func *node)
 {
        char            buf[500];
 
-       sprintf(buf, "FUNC");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "FUNC");
        sprintf(buf, " :funcid %u", node->funcid);
        appendStringInfo(str, buf);
        sprintf(buf, " :functype %u", node->functype);
        appendStringInfo(str, buf);
-       sprintf(buf, " :funcisindex %s",
-                       (node->funcisindex ? "true" : "nil"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :funcisindex ");
+       appendStringInfo(str, (node->funcisindex ? "true" : "false"));
        sprintf(buf, " :funcsize %d", node->funcsize);
        appendStringInfo(str, buf);
        sprintf(buf, " :func_fcache @ 0x%x", (int) (node->func_fcache));
@@ -852,8 +834,7 @@ _outOper(StringInfo str, Oper *node)
 {
        char            buf[500];
 
-       sprintf(buf, "OPER");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "OPER");
        sprintf(buf, " :opno %u", node->opno);
        appendStringInfo(str, buf);
        sprintf(buf, " :opid %u", node->opid);
@@ -871,14 +852,13 @@ _outParam(StringInfo str, Param *node)
 {
        char            buf[500];
 
-       sprintf(buf, "PARAM");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "PARAM");
        sprintf(buf, " :paramkind %d", node->paramkind);
        appendStringInfo(str, buf);
        sprintf(buf, " :paramid %hd", node->paramid);
        appendStringInfo(str, buf);
-       sprintf(buf, " :paramname \"%s\"", node->paramname);
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :paramname ");
+       appendStringInfo(str, node->paramname);
        sprintf(buf, " :paramtype %u", node->paramtype);
        appendStringInfo(str, buf);
 
@@ -898,13 +878,11 @@ _outEState(StringInfo str, EState *node)
 {
        char            buf[500];
 
-       sprintf(buf, "ESTATE");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "ESTATE");
        sprintf(buf, " :direction %d", node->es_direction);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :range_table ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :range_table ");
        _outNode(str, node->es_range_table);
 
        sprintf(buf, " :result_relation_info @ 0x%x",
@@ -921,15 +899,13 @@ _outRel(StringInfo str, Rel *node)
 {
        char            buf[500];
 
-       sprintf(buf, "REL");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "REL");
 
-       sprintf(buf, " :relids ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :relids ");
        _outIntList(str, node->relids);
 
-       sprintf(buf, " :indexed %s", (node->indexed ? "true" : "nil"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indexed ");
+       appendStringInfo(str, node->indexed ? "true" : "false");
        sprintf(buf, " :pages %u", node->pages);
        appendStringInfo(str, buf);
        sprintf(buf, " :tuples %u", node->tuples);
@@ -939,12 +915,10 @@ _outRel(StringInfo str, Rel *node)
        sprintf(buf, " :width %u", node->width);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :targetlist ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :targetlist ");
        _outNode(str, node->targetlist);
 
-       sprintf(buf, " :pathlist ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :pathlist ");
        _outNode(str, node->pathlist);
 
        /*
@@ -958,33 +932,27 @@ _outRel(StringInfo str, Rel *node)
        sprintf(buf, " :cheapestpath @ 0x%x", (int) (node->cheapestpath));
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :pruneable %s", (node->pruneable ? "true" : "nil"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :pruneable ");
+       appendStringInfo(str, node->pruneable ? "true" : "false");
 
 #if 0
-       sprintf(buf, " :classlist ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :classlist ");
        _outNode(str, node->classlist);
 
-       sprintf(buf, " :indexkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indexkeys ");
        _outNode(str, node->indexkeys);
 
-       sprintf(buf, " :ordering ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :ordering ");
        _outNode(str, node->ordering);
 #endif
 
-       sprintf(buf, " :clauseinfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :clauseinfo ");
        _outNode(str, node->clauseinfo);
 
-       sprintf(buf, " :joininfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :joininfo ");
        _outNode(str, node->joininfo);
 
-       sprintf(buf, " :innerjoin ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :innerjoin ");
        _outNode(str, node->innerjoin);
 
 }
@@ -995,24 +963,12 @@ _outRel(StringInfo str, Rel *node)
 static void
 _outTargetEntry(StringInfo str, TargetEntry *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "TLE");
-       appendStringInfo(str, buf);
-       sprintf(buf, " :resdom ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "TLE");
+       appendStringInfo(str, " :resdom ");
        _outNode(str, node->resdom);
 
-       sprintf(buf, " :expr ");
-       appendStringInfo(str, buf);
-       if (node->expr)
-       {
-               _outNode(str, node->expr);
-       }
-       else
-       {
-               appendStringInfo(str, "nil");
-       }
+       appendStringInfo(str, " :expr ");
+       _outNode(str, node->expr);
 }
 
 static void
@@ -1020,19 +976,16 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
 {
        char            buf[500];
 
-       sprintf(buf, "RTE");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "RTE");
 
-       sprintf(buf, " :relname \"%s\"",
-                       ((node->relname) ? ((char *) node->relname) : "null"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :relname ");
+       appendStringInfo(str, node->relname);
 
        sprintf(buf, " :inh %d ", node->inh);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :refname \"%s\"",
-                       ((node->refname) ? ((char *) node->refname) : "null"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :refname ");
+       appendStringInfo(str, node->refname);
 
        sprintf(buf, " :relid %u ", node->relid);
        appendStringInfo(str, buf);
@@ -1046,8 +999,7 @@ _outPath(StringInfo str, Path *node)
 {
        char            buf[500];
 
-       sprintf(buf, "PATH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "PATH");
 
        sprintf(buf, " :pathtype %d", node->pathtype);
        appendStringInfo(str, buf);
@@ -1055,8 +1007,7 @@ _outPath(StringInfo str, Path *node)
        sprintf(buf, " :cost %f", node->path_cost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :keys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :keys ");
        _outNode(str, node->keys);
 
 }
@@ -1069,8 +1020,7 @@ _outIndexPath(StringInfo str, IndexPath *node)
 {
        char            buf[500];
 
-       sprintf(buf, "INDEXPATH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "INDEXPATH");
 
        sprintf(buf, " :pathtype %d", node->path.pathtype);
        appendStringInfo(str, buf);
@@ -1084,20 +1034,16 @@ _outIndexPath(StringInfo str, IndexPath *node)
        appendStringInfo(str, buf);
 
 #if 0
-       sprintf(buf, " :p_ordering ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :p_ordering ");
        _outNode(str, node->path.p_ordering);
 #endif
-       sprintf(buf, " :keys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :keys ");
        _outNode(str, node->path.keys);
 
-       sprintf(buf, " :indexid ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indexid ");
        _outIntList(str, node->indexid);
 
-       sprintf(buf, " :indexqual ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indexqual ");
        _outNode(str, node->indexqual);
 
 }
@@ -1110,8 +1056,7 @@ _outJoinPath(StringInfo str, JoinPath *node)
 {
        char            buf[500];
 
-       sprintf(buf, "JOINPATH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "JOINPATH");
 
        sprintf(buf, " :pathtype %d", node->path.pathtype);
        appendStringInfo(str, buf);
@@ -1125,16 +1070,13 @@ _outJoinPath(StringInfo str, JoinPath *node)
        appendStringInfo(str, buf);
 
 #if 0
-       sprintf(buf, " :p_ordering ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :p_ordering ");
        _outNode(str, node->path.p_ordering);
 #endif
-       sprintf(buf, " :keys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :keys ");
        _outNode(str, node->path.keys);
 
-       sprintf(buf, " :pathclauseinfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :pathclauseinfo ");
        _outNode(str, node->pathclauseinfo);
 
        /*
@@ -1150,8 +1092,7 @@ _outJoinPath(StringInfo str, JoinPath *node)
        sprintf(buf, " :outerjoincost %f", node->path.outerjoincost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :joinid ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :joinid ");
        _outIntList(str, node->path.joinid);
 
 }
@@ -1164,8 +1105,7 @@ _outMergePath(StringInfo str, MergePath *node)
 {
        char            buf[500];
 
-       sprintf(buf, "MERGEPATH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "MERGEPATH");
 
        sprintf(buf, " :pathtype %d", node->jpath.path.pathtype);
        appendStringInfo(str, buf);
@@ -1173,12 +1113,10 @@ _outMergePath(StringInfo str, MergePath *node)
        sprintf(buf, " :cost %f", node->jpath.path.path_cost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :keys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :keys ");
        _outNode(str, node->jpath.path.keys);
 
-       sprintf(buf, " :pathclauseinfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :pathclauseinfo ");
        _outNode(str, node->jpath.pathclauseinfo);
 
        /*
@@ -1194,20 +1132,16 @@ _outMergePath(StringInfo str, MergePath *node)
        sprintf(buf, " :outerjoincost %f", node->jpath.path.outerjoincost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :joinid ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :joinid ");
        _outIntList(str, node->jpath.path.joinid);
 
-       sprintf(buf, " :path_mergeclauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :path_mergeclauses ");
        _outNode(str, node->path_mergeclauses);
 
-       sprintf(buf, " :outersortkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :outersortkeys ");
        _outNode(str, node->outersortkeys);
 
-       sprintf(buf, " :innersortkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :innersortkeys ");
        _outNode(str, node->innersortkeys);
 
 }
@@ -1220,8 +1154,7 @@ _outHashPath(StringInfo str, HashPath *node)
 {
        char            buf[500];
 
-       sprintf(buf, "HASHPATH");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "HASHPATH");
 
        sprintf(buf, " :pathtype %d", node->jpath.path.pathtype);
        appendStringInfo(str, buf);
@@ -1229,12 +1162,10 @@ _outHashPath(StringInfo str, HashPath *node)
        sprintf(buf, " :cost %f", node->jpath.path.path_cost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :keys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :keys ");
        _outNode(str, node->jpath.path.keys);
 
-       sprintf(buf, " :pathclauseinfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :pathclauseinfo ");
        _outNode(str, node->jpath.pathclauseinfo);
 
        /*
@@ -1250,20 +1181,16 @@ _outHashPath(StringInfo str, HashPath *node)
        sprintf(buf, " :outerjoincost %f", node->jpath.path.outerjoincost);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :joinid ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :joinid ");
        _outIntList(str, node->jpath.path.joinid);
 
-       sprintf(buf, " :path_hashclauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :path_hashclauses ");
        _outNode(str, node->path_hashclauses);
 
-       sprintf(buf, " :outerhashkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :outerhashkeys ");
        _outNode(str, node->outerhashkeys);
 
-       sprintf(buf, " :innerhashkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :innerhashkeys ");
        _outNode(str, node->innerhashkeys);
 
 }
@@ -1276,8 +1203,7 @@ _outOrderKey(StringInfo str, OrderKey *node)
 {
        char            buf[500];
 
-       sprintf(buf, "ORDERKEY");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "ORDERKEY");
        sprintf(buf, " :attribute_number %d", node->attribute_number);
        appendStringInfo(str, buf);
        sprintf(buf, " :array_index %d", node->array_index);
@@ -1291,17 +1217,12 @@ _outOrderKey(StringInfo str, OrderKey *node)
 static void
 _outJoinKey(StringInfo str, JoinKey *node)
 {
-       char            buf[500];
+       appendStringInfo(str, "JOINKEY");
 
-       sprintf(buf, "JOINKEY");
-       appendStringInfo(str, buf);
-
-       sprintf(buf, " :outer ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :outer ");
        _outNode(str, node->outer);
 
-       sprintf(buf, " :inner ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :inner ");
        _outNode(str, node->inner);
 
 }
@@ -1314,8 +1235,7 @@ _outMergeOrder(StringInfo str, MergeOrder *node)
 {
        char            buf[500];
 
-       sprintf(buf, "MERGEORDER");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "MERGEORDER");
 
        sprintf(buf, " :join_operator %d", node->join_operator);
        appendStringInfo(str, buf);
@@ -1338,24 +1258,20 @@ _outCInfo(StringInfo str, CInfo *node)
 {
        char            buf[500];
 
-       sprintf(buf, "CINFO");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "CINFO");
 
-       sprintf(buf, " :clause ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :clause ");
        _outNode(str, node->clause);
 
        sprintf(buf, " :selectivity %f", node->selectivity);
        appendStringInfo(str, buf);
-       sprintf(buf, " :notclause %s", (node->notclause ? "true" : "nil"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :notclause ");
+       appendStringInfo(str, node->notclause ? "true" : "false");
 
-       sprintf(buf, " :indexids ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :indexids ");
        _outNode(str, node->indexids);
 
-       sprintf(buf, " :mergesortorder ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :mergesortorder ");
        _outNode(str, node->mergesortorder);
 
        sprintf(buf, " :hashjoinoperator %u", node->hashjoinoperator);
@@ -1369,17 +1285,12 @@ _outCInfo(StringInfo str, CInfo *node)
 static void
 _outJoinMethod(StringInfo str, JoinMethod *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "JOINMETHOD");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "JOINMETHOD");
 
-       sprintf(buf, " :jmkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :jmkeys ");
        _outNode(str, node->jmkeys);
 
-       sprintf(buf, " :clauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :clauses ");
        _outNode(str, node->clauses);
 
 
@@ -1393,20 +1304,16 @@ _outHInfo(StringInfo str, HInfo *node)
 {
        char            buf[500];
 
-       sprintf(buf, "HASHINFO");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "HASHINFO");
 
-       sprintf(buf, " :hashop ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :hashop ");
        sprintf(buf, "%u", node->hashop);
        appendStringInfo(str, buf);
 
-       sprintf(buf, " :jmkeys ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :jmkeys ");
        _outNode(str, node->jmethod.jmkeys);
 
-       sprintf(buf, " :clauses ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :clauses ");
        _outNode(str, node->jmethod.clauses);
 
 }
@@ -1417,25 +1324,18 @@ _outHInfo(StringInfo str, HInfo *node)
 static void
 _outJInfo(StringInfo str, JInfo *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "JINFO");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "JINFO");
 
-       sprintf(buf, " :otherrels ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :otherrels ");
        _outIntList(str, node->otherrels);
 
-       sprintf(buf, " :jinfoclauseinfo ");
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :jinfoclauseinfo ");
        _outNode(str, node->jinfoclauseinfo);
 
-       sprintf(buf, " :mergesortable %s",
-                       (node->mergesortable ? "true" : "nil"));
-       appendStringInfo(str, buf);
-       sprintf(buf, " :hashjoinable %s",
-                       (node->hashjoinable ? "true" : "nil"));
-       appendStringInfo(str, buf);
+       appendStringInfo(str, " :mergesortable ");
+       appendStringInfo(str, node->mergesortable ? "true" : "false");
+       appendStringInfo(str, " :hashjoinable ");
+       appendStringInfo(str, node->hashjoinable ? "true" : "false");
 
 }
 
@@ -1550,10 +1450,8 @@ _outStream(StringInfo str, Stream *node)
 static void
 _outAExpr(StringInfo str, A_Expr *node)
 {
-       char            buf[500];
-
-       sprintf(buf, "EXPR %s", node->opname);
-       appendStringInfo(str, buf);
+       appendStringInfo(str, "EXPR ");
+       appendStringInfo(str, node->opname);
        _outNode(str, node->lexpr);
        _outNode(str, node->rexpr);
        return;
@@ -1589,7 +1487,7 @@ _outIdent(StringInfo str, Ident *node)
 {
        char            buf[500];
 
-       sprintf(buf, "IDENT %s", node->name);
+       sprintf(buf, "IDENT \"%s\"", node->name);
        appendStringInfo(str, buf);
        return;
 }
@@ -1614,7 +1512,7 @@ _outNode(StringInfo str, void *obj)
 {
        if (obj == NULL)
        {
-               appendStringInfo(str, "nil");
+               appendStringInfo(str, "\"\"");
                return;
        }
 
@@ -1653,6 +1551,9 @@ _outNode(StringInfo str, void *obj)
                        case T_Query:
                                _outQuery(str, obj);
                                break;
+                       case T_SortGroupBy:
+                               _outSortGroupBy(str, obj);
+                               break;
                        case T_Plan:
                                _outPlan(str, obj);
                                break;
index 28f3f20847256a210665f591ad91db278ab4e0e0..ef12ecf7347fdebfcf83e7207e09f9129fd95b78 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.6 1998/01/05 03:31:40 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.7 1998/01/06 18:52:18 momjian Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -94,7 +94,7 @@ nodeTokenType(char *token, int length)
 
                retval = (*token != '.') ? T_Integer : T_Float;
        }
-       else if (isalpha(*token))
+       else if (isalpha(*token) || *token == '_')
                retval = ATOM_TOKEN;
        else if (*token == '(')
                retval = LEFT_PAREN;
@@ -145,8 +145,12 @@ lsptok(char *string, int *length)
 
        if (*local_str == '\"')
        {
-               for (local_str++; *local_str != '\"'; (*length)++, local_str++);
-               (*length)++;
+               for (local_str++; *local_str != '\"'; (*length)++, local_str++)
+                       ;
+               if (*length == 2)
+                       *length -= 2;   /* if "", return zero length */
+               else
+                       (*length)++;
                local_str++;
        }
        else if (*local_str == ')' || *local_str == '(' ||
@@ -225,12 +229,12 @@ nodeRead(bool read_car_only)
                case AT_SYMBOL:
                        break;
                case ATOM_TOKEN:
-                       if (!strncmp(token, "nil", 3))
+                       if (!strncmp(token, "\"\"", 2))
                        {
                                this_value = NULL;
 
                                /*
-                                * It might be "nil" but it is an atom!
+                                * It might be NULL but it is an atom!
                                 */
                                if (read_car_only)
                                {
@@ -283,6 +287,7 @@ nodeRead(bool read_car_only)
                List       *l = makeNode(List);
 
                lfirst(l) = this_value;
+
                if (!read_car_only)
                {
                        lnext(l) = nodeRead(false);
index 7ac0e725e787a1aa1e07f2bf0e4f9ac767242c06..d43646c92d6e12258fb12475344ee002ec9db545 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.13 1998/01/05 03:31:45 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.14 1998/01/06 18:52:22 momjian Exp $
  *
  * NOTES
  *       Most of the read functions for plan nodes are tested. (In fact, they
@@ -76,16 +76,19 @@ _readQuery()
        Query      *local_node;
        char       *token;
        int                     length;
-
+       int                     i;
+       
        local_node = makeNode(Query);
 
        token = lsptok(NULL, &length);          /* skip the :command */
        token = lsptok(NULL, &length);          /* get the commandType */
        local_node->commandType = atoi(token);
 
-       token = lsptok(NULL, &length);          /* skip the :utility */
+       token = lsptok(NULL, &length);          /* skip :utility */
+               /* we can't get create or index here, can we? */
+
        token = lsptok(NULL, &length);          /* get the notify name if any */
-       if (token[0] == '"' && token[1] == '"')
+       if (length == 0)
                local_node->utilityStmt = NULL;
        else
        {
@@ -96,17 +99,35 @@ _readQuery()
                local_node->utilityStmt = (Node *) n;
        }
 
-       token = lsptok(NULL, &length);          /* skip the :resrel */
+       token = lsptok(NULL, &length);          /* skip the :resultRelation */
        token = lsptok(NULL, &length);          /* get the resultRelation */
        local_node->resultRelation = atoi(token);
 
-       token = lsptok(NULL, &length);          /* skip :rtable */
-       local_node->rtable = nodeRead(true);
-
-       token = lsptok(NULL, &length);          /* skip the :unique */
-       token = lsptok(NULL, &length);          /* get the uniqueFlag */
-/*       local_node->uniqueFlag = (bool)atoi(token); */
-       if (token[0] == '"' && token[1] == '"')         /* non-unique */
+       token = lsptok(NULL, &length);          /* skip :into */
+       token = lsptok(NULL, &length);          /* get into */
+       if (length == 0)
+               local_node->into = NULL;
+       else
+       {
+               local_node->into = palloc(length + 1);
+               StrNCpy(local_node->into, token, length+1);
+       }
+
+       token = lsptok(NULL, &length);          /* skip :isPortal */
+       token = lsptok(NULL, &length);          /* get isPortal */
+       local_node->isPortal = (token[0] == 't') ? true : false;
+       
+       token = lsptok(NULL, &length);          /* skip :isBinary */
+       token = lsptok(NULL, &length);          /* get isBinary */
+       local_node->isBinary = (token[0] == 't') ? true : false;
+       
+       token = lsptok(NULL, &length);          /* skip :unionall */
+       token = lsptok(NULL, &length);          /* get unionall */
+       local_node->unionall = (token[0] == 't') ? true : false;
+       
+       token = lsptok(NULL, &length);          /* skip :uniqueFlag */
+       token = lsptok(NULL, &length);          /* get uniqueFlag */
+       if (length == 0)
                local_node->uniqueFlag = NULL;
        else
        {
@@ -114,12 +135,90 @@ _readQuery()
                StrNCpy(local_node->uniqueFlag, token, length+1);
        }
 
+       token = lsptok(NULL, &length);          /* skip :sortClause */
+       local_node->sortClause = nodeRead(true);
+
+       token = lsptok(NULL, &length);          /* skip :rtable */
+       local_node->rtable = nodeRead(true);
+
        token = lsptok(NULL, &length);          /* skip :targetlist */
        local_node->targetList = nodeRead(true);
 
        token = lsptok(NULL, &length);          /* skip :qual */
        local_node->qual = nodeRead(true);
-       /* how are we handling aggregates, sort, and group by? bjm 1997/12/26 */
+
+       token = lsptok(NULL, &length);          /* skip :groupClause */
+       local_node->groupClause = nodeRead(true);
+
+       token = lsptok(NULL, &length);          /* skip :havingQual */
+       local_node->havingQual = nodeRead(true);
+
+       token = lsptok(NULL, &length);          /* skip the :qry_numAgg */
+       token = lsptok(NULL, &length);          /* get qry_numAgg */
+       local_node->qry_numAgg = atoi(token);
+
+       token = lsptok(NULL, &length);          /* skip the :qry_Aggs */
+       if (local_node->qry_numAgg == 0)
+               local_node->qry_aggs = NULL;
+       else
+       {
+               local_node->qry_aggs = palloc(sizeof(Aggreg *) * local_node->qry_numAgg);
+               for (i=0; i < local_node->qry_numAgg; i++)
+                       local_node->qry_aggs[i] = nodeRead(true);
+       }
+
+       token = lsptok(NULL, &length);          /* skip :unionClause */
+       local_node->unionClause = nodeRead(true);
+
+       return (local_node);
+}
+
+/* ----------------
+ *             _readSortGroupBy
+ * ----------------
+ */
+static SortGroupBy *
+_readSortGroupBy()
+{
+       SortGroupBy *local_node;
+       char       *token;
+       int                     length;
+
+       local_node = makeNode(SortGroupBy);
+
+       token = lsptok(NULL, &length);          /* skip the :resno */
+       token = lsptok(NULL, &length);          /* get resno */
+       local_node->resno = atoi(token);
+
+       token = lsptok(NULL, &length);          /* skip :range */
+       token = lsptok(NULL, &length);          /* get range */
+       if (length == 0)
+               local_node->range = NULL;
+       else
+       {
+               local_node->range = palloc(length + 1);
+               StrNCpy(local_node->range, token, length+1);
+       }
+
+       token = lsptok(NULL, &length);          /* skip :name */
+       token = lsptok(NULL, &length);          /* get name */
+       if (length == 0)
+               local_node->name = NULL;
+       else
+       {
+               local_node->name = palloc(length + 1);
+               StrNCpy(local_node->name, token, length+1);
+       }
+
+       token = lsptok(NULL, &length);          /* skip :useOp */
+       token = lsptok(NULL, &length);          /* get useOp */
+       if (length == 0)
+               local_node->useOp = NULL;
+       else
+       {
+               local_node->useOp = palloc(length + 1);
+               StrNCpy(local_node->useOp, token, length+1);
+       }
 
        return (local_node);
 }
@@ -239,6 +338,9 @@ _readAppend()
        token = lsptok(NULL, &length);          /* eat :unionplans */
        local_node->unionplans = nodeRead(true);        /* now read it */
 
+       token = lsptok(NULL, &length);          /* eat :unionrts */
+       local_node->unionrts = nodeRead(true);  /* now read it */
+
        token = lsptok(NULL, &length);          /* eat :unionrelid */
        token = lsptok(NULL, &length);          /* get unionrelid */
        local_node->unionrelid = atoi(token);
@@ -623,23 +725,12 @@ _readResdom()
        token = lsptok(NULL, &length);          /* eat :resname */
        token = lsptok(NULL, &length);          /* get the name */
 
-       if (!strncmp(token, "\"null\"", 5))
-       {
+       if (length == 0)
                local_node->resname = NULL;
-       }
        else
        {
-
-               /*
-                * Peel off ""'s, then make a true copy.
-                */
-
-               token++;
-               token[length - 2] = '\0';
-
-               local_node->resname = palloc(length);
-               strcpy(local_node->resname, token);
-               token[length - 2] = '\"';
+               local_node->resname = (char *) palloc(length + 1);
+               StrNCpy(local_node->resname, token, length+1);
        }
 
        token = lsptok(NULL, &length);          /* eat :reskey */
@@ -1016,11 +1107,13 @@ _readParam()
 
        token = lsptok(NULL, &length);          /* get :paramname */
        token = lsptok(NULL, &length);          /* now read it */
-       token++;                                        /* skip the first `"' */
-       token[length - 2] = '\0';       /* this is the 2nd `"' */
-
-       local_node->paramname = pstrdup(token);
-       token[length - 2] = '\"';       /* restore the 2nd `"' */
+       if (length == 0)
+               local_node->paramname = NULL;
+       else
+       {
+               local_node->paramname = (char *) palloc(length + 1);
+               StrNCpy(local_node->paramname, token, length+1);
+       }
 
        token = lsptok(NULL, &length);          /* get :paramtype */
        token = lsptok(NULL, &length);          /* now read it */
@@ -1060,12 +1153,16 @@ _readAggreg()
        token = lsptok(NULL, &length);          /* get aggtype */
        local_node->aggtype = (Oid) atol(token);
 
+       token = lsptok(NULL, &length);          /* eat :target */
+       local_node->target = nodeRead(true);            /* now read it */
+
        token = lsptok(NULL, &length);          /* eat :aggno */
        token = lsptok(NULL, &length);          /* get aggno */
        local_node->aggno = atoi(token);
 
-       token = lsptok(NULL, &length);          /* eat :target */
-       local_node->target = nodeRead(true);            /* now read it */
+       token = lsptok(NULL, &length);          /* eat :usenulls */
+       token = lsptok(NULL, &length);          /* get usenulls */
+       local_node->usenulls = (token[0] == 't') ? true : false;
 
        return (local_node);
 }
@@ -1216,7 +1313,7 @@ _readTargetEntry()
 }
 
 /* ----------------
- *             _readTargetEntry
+ *             _readRangeTblEntry
  * ----------------
  */
 static RangeTblEntry *
@@ -1230,23 +1327,12 @@ _readRangeTblEntry()
 
        token = lsptok(NULL, &length);          /* eat :relname */
        token = lsptok(NULL, &length);          /* get :relname */
-       if (!strncmp(token, "\"null\"", 5))
-       {
+       if (length == 0)
                local_node->relname = NULL;
-       }
        else
        {
-
-               /*
-                * Peel off ""'s, then make a true copy.
-                */
-
-               token++;
-               token[length - 2] = '\0';
-
-               local_node->relname = (char *) palloc(NAMEDATALEN);
-               strcpy(local_node->relname, token);
-               token[length - 2] = '\"';
+               local_node->relname = (char *) palloc(length + 1);
+               StrNCpy(local_node->relname, token, length+1);
        }
 
        token = lsptok(NULL, &length);          /* eat :inh */
@@ -1255,22 +1341,12 @@ _readRangeTblEntry()
 
        token = lsptok(NULL, &length);          /* eat :refname */
        token = lsptok(NULL, &length);          /* get :refname */
-       if (!strncmp(token, "\"null\"", 5))
-       {
+       if (length == 0)
                local_node->refname = NULL;
-       }
        else
        {
-
-               /*
-                * Peel off ""'s, then make a true copy.
-                */
-
-               token++;
-               token[length - 2] = '\0';
-
-               local_node->refname = (char *) pstrdup(token);
-               token[length - 2] = '\"';
+               local_node->refname = (char *) palloc(length + 1);
+               StrNCpy(local_node->refname, token, length+1);
        }
 
        token = lsptok(NULL, &length);          /* eat :relid */
@@ -2032,6 +2108,10 @@ parsePlanString(void)
        {
                return_value = _readQuery();
        }
+       else if (!strncmp(token, "SORTGROUPBY", 11))
+       {
+               return_value = _readSortGroupBy();
+       }
        else
        {
                elog(ABORT, "badly formatted planstring \"%.10s\"...\n", token);
index 4358f1915038c82e4459139555684d4c7295a888..2a8c49e624da52657051c3031c622d92e7d36410 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.9 1998/01/05 03:31:55 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.10 1998/01/06 18:52:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,21 +76,18 @@ prune_joinrel(Rel *rel, List *other_rels)
        return_list = cur;
        
        /* remove relations that do match, we use lnext so we can remove easily */
-       if (cur != NIL)
+       while (cur != NIL && lnext(cur) != NIL)
        {
-               while (lnext(cur) != NIL)
-               {
-                       Rel     *other_rel = (Rel *) lfirst(lnext(cur));
+               Rel     *other_rel = (Rel *) lfirst(lnext(cur));
 
-                       if (same(rel->relids, other_rel->relids))
-                       {
-                               rel->pathlist = add_pathlist(rel,
-                                                                                        rel->pathlist,
-                                                                                        other_rel->pathlist);
-                               lnext(cur) = lnext(lnext(cur)); /* delete it */
-                       }
-                       cur = lnext(cur);
+               if (same(rel->relids, other_rel->relids))
+               {
+                       rel->pathlist = add_pathlist(rel,
+                                                                                rel->pathlist,
+                                                                                other_rel->pathlist);
+                       lnext(cur) = lnext(lnext(cur)); /* delete it */
                }
+               cur = lnext(cur);
        }
        return return_list;
 }
index 83bda8aae828a9f0d9204d0b0150ba9ea9d4dd69..50f10bf8e8de10f26e10cccdf9e0e63bbb3b1c9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.18 1998/01/05 03:35:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.19 1998/01/06 18:53:02 momjian Exp $
  */
 
 #include <float.h>                             /* faked on sunos */
@@ -450,7 +450,7 @@ ttdummy()
        if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
                elog(ABORT, "ttdummy: must be fired before event");
        if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
-               elog (WARN, "ttdummy: can't process INSERT event");
+               elog (ABORT, "ttdummy: can't process INSERT event");
        if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
                newtuple = CurrentTriggerData->tg_newtuple;
        
@@ -506,7 +506,7 @@ ttdummy()
                        elog(ABORT, "ttdummy (%s): %s must be NOT NULL", relname, args[1]);
                
                if ( oldon != newon || oldoff != newoff )
-                       elog (WARN, "ttdummy (%s): you can't change %s and/or %s columns (use set_ttdummy)",
+                       elog (ABORT, "ttdummy (%s): you can't change %s and/or %s columns (use set_ttdummy)",
                                        relname, args[0], args[1]);
                
                if ( newoff != TTDUMMY_INFINITY )