Change some labels in bootparse to make ctags happy. Clean up outfunc/readfunc code and add missing fields for Query structure and new Union fields. Fix optimizer bug shown in new \do command. Change WARN to ERROR in contrib and regression stuff.

This commit is contained in:
Bruce Momjian 1998-01-06 18:53:02 +00:00
parent 42acc6e8c4
commit 9d00fbbeb0
15 changed files with 565 additions and 580 deletions

View 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);
}

View 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);

View 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;

View 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);
}

View 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);

View 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

View 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 */

View 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; }
;
%%

View 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;
}

View 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

File diff suppressed because it is too large Load Diff

View 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);

View 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 :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 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 :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);

View 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;
}

View 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 )