From c72839d5be17911be03632f92c75624aea766af4 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 22 Jul 2003 23:30:39 +0000
Subject: [PATCH] Error message editing in backend/bootstrap, /lib, /nodes,
 /port.

---
 src/backend/bootstrap/bootparse.y    | 10 +++----
 src/backend/bootstrap/bootscanner.l  |  6 ++--
 src/backend/bootstrap/bootstrap.c    | 43 ++++++++++++++--------------
 src/backend/lib/dllist.c             | 14 +++++----
 src/backend/nodes/bitmapset.c        | 16 +++++------
 src/backend/nodes/copyfuncs.c        | 11 +++----
 src/backend/nodes/equalfuncs.c       | 13 +++++----
 src/backend/nodes/list.c             |  6 ++--
 src/backend/nodes/outfuncs.c         | 15 ++++++----
 src/backend/nodes/print.c            |  8 ++++--
 src/backend/nodes/read.c             |  6 ++--
 src/backend/nodes/readfuncs.c        | 21 +++++++-------
 src/backend/port/beos/sem.c          |  8 ++----
 src/backend/port/beos/support.c      | 10 +++----
 src/backend/port/dynloader/bsdi.c    |  9 +++---
 src/backend/port/dynloader/linux.c   |  9 +++---
 src/backend/port/dynloader/ultrix4.c |  5 ++--
 src/backend/port/ipc_test.c          |  4 +--
 src/backend/port/posix_sema.c        |  6 ++--
 src/backend/port/sysv_sema.c         |  8 +++---
 src/backend/port/sysv_shmem.c        |  6 ++--
 21 files changed, 121 insertions(+), 113 deletions(-)

diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index 2f64414aee2..7e6c1600feb 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.58 2003/05/28 16:03:55 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.59 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -155,7 +155,7 @@ Boot_CreateStmt:
 				{
 					do_start();
 					numattr = 0;
-					elog(DEBUG4, "creating%s%s relation %s...",
+					elog(DEBUG4, "creating%s%s relation %s",
 						 $2 ? " bootstrap" : "",
 						 $3 ? " shared" : "",
 						 LexIDStr($5));
@@ -210,9 +210,9 @@ Boot_InsertStmt:
 				{
 					do_start();
 					if ($2)
-						elog(DEBUG4, "inserting row with oid %u...", $2);
+						elog(DEBUG4, "inserting row with oid %u", $2);
 					else
-						elog(DEBUG4, "inserting row...");
+						elog(DEBUG4, "inserting row");
 					num_columns_read = 0;
 				}
 		  LPAREN  boot_tuplelist RPAREN
@@ -302,7 +302,7 @@ boot_typelist:
 boot_type_thing:
 		  boot_ident EQUALS boot_ident
 				{
-				   if(++numattr > MAXATTR)
+				   if (++numattr > MAXATTR)
 						elog(FATAL, "too many columns");
 				   DefineAttr(LexIDStr($1),LexIDStr($3),numattr-1);
 				}
diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l
index fbb104c18a1..c4dcdb293b1 100644
--- a/src/backend/bootstrap/bootscanner.l
+++ b/src/backend/bootstrap/bootscanner.l
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.28 2003/05/29 22:30:01 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.29 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -129,7 +129,7 @@ insert			{ return(INSERT_TUPLE); }
 						}
 
 .				{
-					elog(ERROR, "syntax error at line %d: unexpected character %s", yyline, yytext);
+					elog(ERROR, "syntax error at line %d: unexpected character \"%s\"", yyline, yytext);
 				}
 
 
@@ -139,5 +139,5 @@ insert			{ return(INSERT_TUPLE); }
 void
 yyerror(const char *str)
 {
-	elog(ERROR, "syntax error at line %d: unexpected token %s", yyline, str);
+	elog(ERROR, "syntax error at line %d: unexpected token \"%s\"", yyline, str);
 }
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 6bcf57404b6..e30e5c513c0 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.161 2003/07/15 00:11:13 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.162 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -314,9 +314,15 @@ BootstrapMain(int argc, char *argv[])
 					if (!value)
 					{
 						if (flag == '-')
-							elog(ERROR, "--%s requires argument", optarg);
+							ereport(ERROR,
+									(errcode(ERRCODE_SYNTAX_ERROR),
+									 errmsg("--%s requires a value",
+											optarg)));
 						else
-							elog(ERROR, "-c %s requires argument", optarg);
+							ereport(ERROR,
+									(errcode(ERRCODE_SYNTAX_ERROR),
+									 errmsg("-c %s requires a value",
+											optarg)));
 					}
 
 					SetConfigOption(name, value, PGC_POSTMASTER, PGC_S_ARGV);
@@ -455,7 +461,7 @@ BootstrapMain(int argc, char *argv[])
 			proc_exit(0);		/* done */
 
 		default:
-			elog(PANIC, "Unsupported XLOG op %d", xlogop);
+			elog(PANIC, "unrecognized XLOG op: %d", xlogop);
 			proc_exit(0);
 	}
 
@@ -566,7 +572,8 @@ boot_openrel(char *relname)
 	if (boot_reldesc != NULL)
 		closerel(NULL);
 
-	elog(DEBUG4, "open relation %s, attrsize %d", relname ? relname : "(null)",
+	elog(DEBUG4, "open relation %s, attrsize %d",
+		 relname ? relname : "(null)",
 		 (int) ATTRIBUTE_TUPLE_SIZE);
 
 	boot_reldesc = heap_openr(relname, NoLock);
@@ -601,11 +608,11 @@ closerel(char *name)
 		if (boot_reldesc)
 		{
 			if (strcmp(RelationGetRelationName(boot_reldesc), name) != 0)
-				elog(ERROR, "closerel: close of '%s' when '%s' was expected",
+				elog(ERROR, "close of %s when %s was expected",
 					 name, relname ? relname : "(null)");
 		}
 		else
-			elog(ERROR, "closerel: close of '%s' before any relation was opened",
+			elog(ERROR, "close of %s before any relation was opened",
 				 name);
 	}
 
@@ -637,7 +644,7 @@ DefineAttr(char *name, char *type, int attnum)
 
 	if (boot_reldesc != NULL)
 	{
-		elog(LOG, "warning: no open relations allowed with 'create' command");
+		elog(WARNING, "no open relations allowed with CREATE command");
 		closerel(relname);
 	}
 
@@ -770,7 +777,7 @@ InsertOneValue(char *value, int i)
 
 	AssertArg(i >= 0 || i < MAXATTR);
 
-	elog(DEBUG4, "inserting column %d value '%s'", i, value);
+	elog(DEBUG4, "inserting column %d value \"%s\"", i, value);
 
 	if (Typ != (struct typmap **) NULL)
 	{
@@ -783,7 +790,7 @@ InsertOneValue(char *value, int i)
 		ap = *app;
 		if (ap == NULL)
 		{
-			elog(FATAL, "unable to find atttypid %u in Typ list",
+			elog(FATAL, "could not find atttypid %u in Typ list",
 				 boot_reldesc->rd_att->attrs[i]->atttypid);
 		}
 		values[i] = OidFunctionCall3(ap->am_typ.typinput,
@@ -875,7 +882,7 @@ cleanup(void)
 		beenhere = 1;
 	else
 	{
-		elog(FATAL, "Memory manager fault: cleanup called twice");
+		elog(FATAL, "cleanup called twice");
 		proc_exit(1);
 	}
 	if (boot_reldesc != NULL)
@@ -946,7 +953,7 @@ gettype(char *type)
 		heap_close(rel, NoLock);
 		return gettype(type);
 	}
-	elog(ERROR, "Error: unknown type '%s'.\n", type);
+	elog(ERROR, "unrecognized type \"%s\"", type);
 	err_out();
 	/* not reached, here to make compiler happy */
 	return 0;
@@ -962,7 +969,7 @@ AllocateAttribute(void)
 	Form_pg_attribute attribute = (Form_pg_attribute) malloc(ATTRIBUTE_TUPLE_SIZE);
 
 	if (!PointerIsValid(attribute))
-		elog(FATAL, "AllocateAttribute: malloc failed");
+		elog(FATAL, "out of memory");
 	MemSet(attribute, 0, ATTRIBUTE_TUPLE_SIZE);
 
 	return attribute;
@@ -1109,14 +1116,8 @@ AddStr(char *str, int strlength, int mderef)
 	int			hashresult;
 	int			len;
 
-	if (++strtable_end == STRTABLESIZE)
-	{
-		/* Error, string table overflow, so we Punt */
-		elog(FATAL,
-			 "There are too many string constants and identifiers for the compiler to handle.");
-
-
-	}
+	if (++strtable_end >= STRTABLESIZE)
+		elog(FATAL, "bootstrap string table overflow");
 
 	/*
 	 * Some of the utilites (eg, define type, create relation) assume that
diff --git a/src/backend/lib/dllist.c b/src/backend/lib/dllist.c
index 8c13ddfb0f7..42b3c4f819e 100644
--- a/src/backend/lib/dllist.c
+++ b/src/backend/lib/dllist.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.25 2002/06/20 20:29:28 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.26 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,10 +35,12 @@ DLNewList(void)
 	if (l == NULL)
 	{
 #ifdef FRONTEND
-		fprintf(stderr, "Memory exhausted in DLNewList\n");
+		fprintf(stderr, "memory exhausted in DLNewList\n");
 		exit(1);
 #else
-		elog(ERROR, "Memory exhausted in DLNewList");
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory")));
 #endif
 	}
 	l->dll_head = 0;
@@ -78,10 +80,12 @@ DLNewElem(void *val)
 	if (e == NULL)
 	{
 #ifdef FRONTEND
-		fprintf(stderr, "Memory exhausted in DLNewElem\n");
+		fprintf(stderr, "memory exhausted in DLNewElem\n");
 		exit(1);
 #else
-		elog(ERROR, "Memory exhausted in DLNewElem");
+		ereport(ERROR,
+				(errcode(ERRCODE_OUT_OF_MEMORY),
+				 errmsg("out of memory")));
 #endif
 	}
 	e->dle_next = 0;
diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index 45c6ead0fc0..c4576cf3b3d 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -14,7 +14,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/bitmapset.c,v 1.2 2003/06/29 23:05:04 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/bitmapset.c,v 1.3 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -184,7 +184,7 @@ bms_make_singleton(int x)
 				bitnum;
 
 	if (x < 0)
-		elog(ERROR, "bms_make_singleton: negative set member not allowed");
+		elog(ERROR, "negative bitmapset member not allowed");
 	wordnum = WORDNUM(x);
 	bitnum = BITNUM(x);
 	result = (Bitmapset *) palloc0(BITMAPSET_SIZE(wordnum + 1));
@@ -354,7 +354,7 @@ bms_is_member(int x, const Bitmapset *a)
 
 	/* XXX better to just return false for x<0 ? */
 	if (x < 0)
-		elog(ERROR, "bms_is_member: negative set member not allowed");
+		elog(ERROR, "negative bitmapset member not allowed");
 	if (a == NULL)
 		return false;
 	wordnum = WORDNUM(x);
@@ -431,7 +431,7 @@ bms_singleton_member(const Bitmapset *a)
 	int		wordnum;
 
 	if (a == NULL)
-		elog(ERROR, "bms_singleton_member: set is empty");
+		elog(ERROR, "bitmapset is empty");
 	nwords = a->nwords;
 	for (wordnum = 0; wordnum < nwords; wordnum++)
 	{
@@ -440,7 +440,7 @@ bms_singleton_member(const Bitmapset *a)
 		if (w != 0)
 		{
 			if (result >= 0 || HAS_MULTIPLE_ONES(w))
-				elog(ERROR, "bms_singleton_member: set has multiple members");
+				elog(ERROR, "bitmapset has multiple members");
 			result = wordnum * BITS_PER_BITMAPWORD;
 			while ((w & 255) == 0)
 			{
@@ -451,7 +451,7 @@ bms_singleton_member(const Bitmapset *a)
 		}
 	}
 	if (result < 0)
-		elog(ERROR, "bms_singleton_member: set is empty");
+		elog(ERROR, "bitmapset is empty");
 	return result;
 }
 
@@ -558,7 +558,7 @@ bms_add_member(Bitmapset *a, int x)
 				bitnum;
 
 	if (x < 0)
-		elog(ERROR, "bms_add_member: negative set member not allowed");
+		elog(ERROR, "negative bitmapset member not allowed");
 	if (a == NULL)
 		return bms_make_singleton(x);
 	wordnum = WORDNUM(x);
@@ -598,7 +598,7 @@ bms_del_member(Bitmapset *a, int x)
 				bitnum;
 
 	if (x < 0)
-		elog(ERROR, "bms_del_member: negative set member not allowed");
+		elog(ERROR, "negative bitmapset member not allowed");
 	if (a == NULL)
 		return NULL;
 	wordnum = WORDNUM(x);
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index f2b896afe8f..6945e98d5d7 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.259 2003/07/03 16:32:20 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.260 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1328,7 +1328,8 @@ _copyAConst(A_Const *from)
 			/* nothing to do */
 			break;
 		default:
-			elog(ERROR, "_copyAConst: unknown node type %d", from->val.type);
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) from->val.type);
 			break;
 	}
 
@@ -2443,7 +2444,8 @@ _copyValue(Value *from)
 			/* nothing to do */
 			break;
 		default:
-			elog(ERROR, "_copyValue: unknown node type %d", from->type);
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) from->type);
 			break;
 	}
 	return newnode;
@@ -2966,8 +2968,7 @@ copyObject(void *from)
 			break;
 
 		default:
-			elog(ERROR, "copyObject: don't know how to copy node type %d",
-				 nodeTag(from));
+			elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));
 			retval = from;		/* keep compiler quiet */
 			break;
 	}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 2caca93a6b4..e47a3f79456 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -18,7 +18,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.202 2003/07/03 16:32:32 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.203 2003/07/22 23:30:37 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -189,7 +189,7 @@ _equalParam(Param *a, Param *b)
 			COMPARE_SCALAR_FIELD(paramid);
 			break;
 		default:
-			elog(ERROR, "_equalParam: Invalid paramkind value: %d",
+			elog(ERROR, "unrecognized paramkind value: %d",
 				 a->paramkind);
 	}
 
@@ -1616,7 +1616,7 @@ _equalValue(Value *a, Value *b)
 			/* nothing to do */
 			break;
 		default:
-			elog(ERROR, "_equalValue: unknown node type %d", a->type);
+			elog(ERROR, "unrecognized node type: %d", (int) a->type);
 			break;
 	}
 
@@ -1630,7 +1630,7 @@ _equalValue(Value *a, Value *b)
 bool
 equal(void *a, void *b)
 {
-	bool		retval = false;
+	bool		retval;
 
 	if (a == b)
 		return true;
@@ -2081,8 +2081,9 @@ equal(void *a, void *b)
 			break;
 
 		default:
-			elog(WARNING, "equal: don't know whether nodes of type %d are equal",
-				 nodeTag(a));
+			elog(ERROR, "unrecognized node type: %d",
+				 (int) nodeTag(a));
+			retval = false;		/* keep compiler quiet */
 			break;
 	}
 
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index 7467e1a00e1..b0f6821b8c4 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.50 2003/06/15 22:51:45 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.51 2003/07/22 23:30:37 tgl Exp $
  *
  * NOTES
  *	  XXX a few of the following functions are duplicated to handle
@@ -186,7 +186,7 @@ nconc(List *l1, List *l2)
 	if (l2 == NIL)
 		return l1;
 	if (l1 == l2)
-		elog(ERROR, "can't nconc a list to itself");
+		elog(ERROR, "cannot nconc a list to itself");
 
 	for (temp = l1; lnext(temp) != NIL; temp = lnext(temp))
 		;
@@ -352,7 +352,7 @@ void *
 llast(List *l)
 {
 	if (l == NIL)
-		elog(ERROR, "llast: empty list");
+		elog(ERROR, "empty list does not have a last item");
 	while (lnext(l) != NIL)
 		l = lnext(l);
 	return lfirst(l);
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 2f622c9d7c1..3501bf17750 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.212 2003/07/03 16:32:38 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.213 2003/07/22 23:30:37 tgl Exp $
  *
  * NOTES
  *	  Every node type that can appear in stored rules' parsetrees *must*
@@ -1322,7 +1322,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
 			WRITE_NODE_FIELD(joinaliasvars);
 			break;
 		default:
-			elog(ERROR, "bogus rte kind %d", (int) node->rtekind);
+			elog(ERROR, "unrecognized rte kind: %d", (int) node->rtekind);
 			break;
 	}
 
@@ -1410,8 +1410,7 @@ _outValue(StringInfo str, Value *value)
 			appendStringInfo(str, "%s", value->val.str);
 			break;
 		default:
-			elog(WARNING, "_outValue: don't know how to print type %d",
-				 value->type);
+			elog(ERROR, "unrecognized node type: %d", (int) value->type);
 			break;
 	}
 }
@@ -1821,8 +1820,12 @@ _outNode(StringInfo str, void *obj)
 				break;
 
 			default:
-				elog(WARNING, "_outNode: don't know how to print type %d",
-					 nodeTag(obj));
+				/*
+				 * This should be an ERROR, but it's too useful to be able
+				 * to dump structures that _outNode only understands part of.
+				 */
+				elog(WARNING, "could not dump unrecognized node type: %d",
+					 (int) nodeTag(obj));
 				break;
 		}
 		appendStringInfoChar(str, '}');
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 6e8c0d7bf07..187e9211ad9 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.61 2003/05/06 00:20:32 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.62 2003/07/22 23:30:37 tgl Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -82,7 +82,9 @@ elog_node_display(int lev, const char *title, void *obj, bool pretty)
 	else
 		f = format_node_dump(s);
 	pfree(s);
-	elog(lev, "%s:\n%s", title, f);
+	ereport(lev,
+			(errmsg_internal("%s:", title),
+			 errdetail("%s", f)));
 	pfree(f);
 }
 
@@ -350,7 +352,7 @@ print_expr(Node *expr, List *rtable)
 								 ObjectIdGetDatum(c->consttype),
 								 0, 0, 0);
 		if (!HeapTupleIsValid(typeTup))
-			elog(ERROR, "Cache lookup for type %u failed", c->consttype);
+			elog(ERROR, "cache lookup failed for type %u", c->consttype);
 		typoutput = ((Form_pg_type) GETSTRUCT(typeTup))->typoutput;
 		typelem = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
 		ReleaseSysCache(typeTup);
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c
index f1d07ebf490..2099b4dcb41 100644
--- a/src/backend/nodes/read.c
+++ b/src/backend/nodes/read.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.33 2002/11/25 18:12:10 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.34 2003/07/22 23:30:38 tgl Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -293,7 +293,7 @@ nodeRead(bool read_car_only)
 			this_value = parseNodeString();
 			token = pg_strtok(&tok_len);
 			if (token == NULL || token[0] != '}')
-				elog(ERROR, "nodeRead: did not find '}' at end of node");
+				elog(ERROR, "did not find '}' at end of input node");
 			if (!read_car_only)
 				make_dotted_pair_cell = true;
 			else
@@ -373,7 +373,7 @@ nodeRead(bool read_car_only)
 				break;
 			}
 		default:
-			elog(ERROR, "nodeRead: Bad type %d", type);
+			elog(ERROR, "unrecognized node type: %d", (int) type);
 			this_value = NULL;	/* keep compiler happy */
 			break;
 	}
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index da6d10c31ee..abc3a1b0105 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.158 2003/07/03 16:32:39 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.159 2003/07/22 23:30:38 tgl Exp $
  *
  * NOTES
  *	  Path and Plan nodes do not have any readfuncs support, because we
@@ -146,7 +146,7 @@ toIntList(List *list)
 		Value	   *v = (Value *) lfirst(l);
 
 		if (!IsA(v, Integer))
-			elog(ERROR, "toIntList: unexpected datatype");
+			elog(ERROR, "unexpected node type: %d", (int) nodeTag(v));
 		lfirsti(l) = intVal(v);
 		pfree(v);
 	}
@@ -180,7 +180,7 @@ toOidList(List *list)
 			pfree(v);
 		}
 		else
-			elog(ERROR, "toOidList: unexpected datatype");
+			elog(ERROR, "unexpected node type: %d", (int) nodeTag(v));
 	}
 	return list;
 }
@@ -554,7 +554,7 @@ _readBoolExpr(void)
 	else if (strncmp(token, "not", 3) == 0)
 		local_node->boolop = NOT_EXPR;
 	else
-		elog(ERROR, "_readBoolExpr: unknown boolop \"%.*s\"", length, token);
+		elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
 
 	READ_NODE_FIELD(args);
 
@@ -928,7 +928,8 @@ _readRangeTblEntry(void)
 			READ_NODE_FIELD(joinaliasvars);
 			break;
 		default:
-			elog(ERROR, "bogus rte kind %d", (int) local_node->rtekind);
+			elog(ERROR, "unrecognized RTE kind: %d",
+				 (int) local_node->rtekind);
 			break;
 	}
 
@@ -1078,14 +1079,14 @@ readDatum(bool typbyval)
 
 	token = pg_strtok(&tokenLength);	/* read the '[' */
 	if (token == NULL || token[0] != '[')
-		elog(ERROR, "readDatum: expected '%s', got '%s'; length = %lu",
-			 "[", token ? (const char *) token : "[NULL]",
+		elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %lu",
+			 token ? (const char *) token : "[NULL]",
 			 (unsigned long) length);
 
 	if (typbyval)
 	{
 		if (length > (Size) sizeof(Datum))
-			elog(ERROR, "readDatum: byval & length = %lu",
+			elog(ERROR, "byval datum but length = %lu",
 				 (unsigned long) length);
 		res = (Datum) 0;
 		s = (char *) (&res);
@@ -1110,8 +1111,8 @@ readDatum(bool typbyval)
 
 	token = pg_strtok(&tokenLength);	/* read the ']' */
 	if (token == NULL || token[0] != ']')
-		elog(ERROR, "readDatum: expected '%s', got '%s'; length = %lu",
-			 "]", token ? (const char *) token : "[NULL]",
+		elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %lu",
+			 token ? (const char *) token : "[NULL]",
 			 (unsigned long) length);
 
 	return res;
diff --git a/src/backend/port/beos/sem.c b/src/backend/port/beos/sem.c
index 71598fcc4c0..06518e7db7d 100644
--- a/src/backend/port/beos/sem.c
+++ b/src/backend/port/beos/sem.c
@@ -7,13 +7,11 @@
  *
  *-------------------------------------------------------------------------
  */
-
-
 #include "postgres.h"
+
 #include <errno.h>
 #include <unistd.h>
 #include <OS.h>
-#include "utils/elog.h"
 
 /*#define TDBG*/
 #ifdef TDBG
@@ -155,7 +153,7 @@ semctl(int semId, int semNum, int flag, union semun semun)
 	{
 		/* TO BE IMPLEMENTED */
 		TRACEDBG("--semctl getncnt");
-		elog(ERROR, "beos : semctl error : GETNCNT not implemented");
+		elog(ERROR, "semctl error: GETNCNT not implemented");
 		return 0;
 	}
 
@@ -170,7 +168,7 @@ semctl(int semId, int semNum, int flag, union semun semun)
 		return cnt;
 	}
 
-	elog(ERROR, "beos : semctl error : unknown flag");
+	elog(ERROR, "semctl error: unknown flag");
 
 	TRACEDBG("<-semctl unknown flag");
 	return 0;
diff --git a/src/backend/port/beos/support.c b/src/backend/port/beos/support.c
index fbc431021db..6a31adad578 100644
--- a/src/backend/port/beos/support.c
+++ b/src/backend/port/beos/support.c
@@ -42,7 +42,7 @@ beos_dl_open(char *filename)
 
 		if ((beos_dl_port_in <= 0) || (beos_dl_port_out <= 0))
 		{
-			elog(WARNING, "Error loading BeOS support server : can't create communication ports");
+			elog(WARNING, "error loading BeOS support server: could not create communication ports");
 			return B_ERROR;
 		}
 		else
@@ -68,7 +68,7 @@ beos_dl_open(char *filename)
 	/* Checking integrity */
 	if (im < 0)
 	{
-		elog(WARNING, "Can't load this add-on ");
+		elog(WARNING, "could not load this add-on");
 		return B_ERROR;
 	}
 	else
@@ -92,7 +92,7 @@ beos_dl_open(char *filename)
 			/* Remap */
 			resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
 			if (resu < 0)
-				elog(WARNING, "Can't load this add-on : map text error");
+				elog(WARNING, "could not load this add-on: map text error");
 		}
 
 		/* read text segment id and address */
@@ -108,7 +108,7 @@ beos_dl_open(char *filename)
 			/* Remap */
 			resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
 			if (resu < 0)
-				elog(WARNING, "Can't load this add-on : map data error");
+				elog(WARNING, "could not load this add-on: map data error");
 		}
 
 		return im;
@@ -126,7 +126,7 @@ beos_dl_sym(image_id im, char *symname, void **fptr)
 	read_port(beos_dl_port_out, (int32 *) (fptr), NULL, 0);
 
 	if (fptr == NULL)
-		elog(WARNING, "loading symbol '%s' failed ", symname);
+		elog(WARNING, "loading symbol \"%s\" failed", symname);
 }
 
 status_t
diff --git a/src/backend/port/dynloader/bsdi.c b/src/backend/port/dynloader/bsdi.c
index 151e05a55b7..a3c7d5ff074 100644
--- a/src/backend/port/dynloader/bsdi.c
+++ b/src/backend/port/dynloader/bsdi.c
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/bsdi.c,v 1.20 2002/06/20 20:29:33 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/bsdi.c,v 1.21 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -56,14 +56,14 @@ pg_dlopen(char *filename)
 	{
 		if (dld_link("/usr/lib/libc.a"))
 		{
-			elog(WARNING, "dld: Cannot link C library!");
+			elog(WARNING, "could not link C library");
 			return NULL;
 		}
 		if (dld_undefined_sym_count > 0)
 		{
 			if (dld_link("/usr/lib/libm.a"))
 			{
-				elog(WARNING, "dld: Cannot link math library!");
+				elog(WARNING, "could not link math library");
 				return NULL;
 			}
 			if (dld_undefined_sym_count > 0)
@@ -72,10 +72,9 @@ pg_dlopen(char *filename)
 				char	  **list = dld_list_undefined_sym();
 
 				/* list the undefined symbols, if any */
-				elog(WARNING, "dld: Undefined:");
 				do
 				{
-					elog(WARNING, "  %s", *list);
+					elog(WARNING, "\"%s\" is undefined", *list);
 					list++;
 					count--;
 				} while (count > 0);
diff --git a/src/backend/port/dynloader/linux.c b/src/backend/port/dynloader/linux.c
index 2ee15661cdf..f82cfadf6a1 100644
--- a/src/backend/port/dynloader/linux.c
+++ b/src/backend/port/dynloader/linux.c
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.23 2002/10/15 16:04:17 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.24 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,14 +68,14 @@ pg_dlopen(char *filename)
 	{
 		if (dld_link("/usr/lib/libc.a"))
 		{
-			elog(WARNING, "dld: Cannot link C library!");
+			elog(WARNING, "could not link C library");
 			return NULL;
 		}
 		if (dld_undefined_sym_count > 0)
 		{
 			if (dld_link("/usr/lib/libm.a"))
 			{
-				elog(WARNING, "dld: Cannot link math library!");
+				elog(WARNING, "could not link math library");
 				return NULL;
 			}
 			if (dld_undefined_sym_count > 0)
@@ -84,10 +84,9 @@ pg_dlopen(char *filename)
 				char	  **list = dld_list_undefined_sym();
 
 				/* list the undefined symbols, if any */
-				elog(WARNING, "dld: Undefined:");
 				do
 				{
-					elog(WARNING, "  %s", *list);
+					elog(WARNING, "\"%s\" is undefined", *list);
 					list++;
 					count--;
 				} while (count > 0);
diff --git a/src/backend/port/dynloader/ultrix4.c b/src/backend/port/dynloader/ultrix4.c
index 770f3306a02..10aeb9dc25c 100644
--- a/src/backend/port/dynloader/ultrix4.c
+++ b/src/backend/port/dynloader/ultrix4.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.16 2002/11/08 20:23:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.17 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,10 +55,9 @@ pg_dlopen(char *filename)
 		/* list the undefined symbols, if any */
 		if (count)
 		{
-			elog(WARNING, "dl: Undefined:");
 			while (*list)
 			{
-				elog(WARNING, "  %s", *list);
+				elog(WARNING, "\"%s\" is undefined", *list);
 				list++;
 			}
 		}
diff --git a/src/backend/port/ipc_test.c b/src/backend/port/ipc_test.c
index ee1ed186cb5..b14eeef716f 100644
--- a/src/backend/port/ipc_test.c
+++ b/src/backend/port/ipc_test.c
@@ -21,7 +21,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.5 2002/09/04 20:31:24 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.6 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -90,7 +90,7 @@ void
 			on_shmem_exit(void (*function) (), Datum arg)
 {
 	if (on_shmem_exit_index >= MAX_ON_EXITS)
-		elog(FATAL, "Out of on_shmem_exit slots");
+		elog(FATAL, "out of on_shmem_exit slots");
 
 	on_shmem_exit_list[on_shmem_exit_index].function = function;
 	on_shmem_exit_list[on_shmem_exit_index].arg = arg;
diff --git a/src/backend/port/posix_sema.c b/src/backend/port/posix_sema.c
index 21af7d3ac2c..26788667a49 100644
--- a/src/backend/port/posix_sema.c
+++ b/src/backend/port/posix_sema.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/posix_sema.c,v 1.6 2002/09/04 20:31:24 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/posix_sema.c,v 1.7 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -165,7 +165,7 @@ PGReserveSemaphores(int maxSemas, int port)
 {
 	mySemPointers = (sem_t **) malloc(maxSemas * sizeof(sem_t *));
 	if (mySemPointers == NULL)
-		elog(PANIC, "Out of memory in PGReserveSemaphores");
+		elog(PANIC, "out of memory");
 	numSems = 0;
 	maxSems = maxSemas;
 	nextSemKey = port * 1000;
@@ -202,7 +202,7 @@ PGSemaphoreCreate(PGSemaphore sema)
 	Assert(!IsUnderPostmaster);
 
 	if (numSems >= maxSems)
-		elog(PANIC, "PGSemaphoreCreate: too many semaphores created");
+		elog(PANIC, "too many semaphores created");
 
 #ifdef USE_NAMED_POSIX_SEMAPHORES
 	*sema = newsem = PosixSemaphoreCreate();
diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c
index a555a22a82f..f9a00d4bedb 100644
--- a/src/backend/port/sysv_sema.c
+++ b/src/backend/port/sysv_sema.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/sysv_sema.c,v 1.5 2003/03/25 16:15:44 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/sysv_sema.c,v 1.6 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -177,7 +177,7 @@ IpcSemaphoreKill(IpcSemaphoreId semId)
 				semId, strerror(errno));
 
 	/*
-	 * We used to report a failure via elog(WARNING), but that's pretty
+	 * We used to report a failure via ereport(WARNING), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
@@ -316,7 +316,7 @@ PGReserveSemaphores(int maxSemas, int port)
 	mySemaSets = (IpcSemaphoreId *)
 		malloc(maxSemaSets * sizeof(IpcSemaphoreId));
 	if (mySemaSets == NULL)
-		elog(PANIC, "Out of memory in PGReserveSemaphores");
+		elog(PANIC, "out of memory");
 	numSemaSets = 0;
 	nextSemaKey = port * 1000;
 	nextSemaNumber = SEMAS_PER_SET;		/* force sema set alloc on 1st
@@ -355,7 +355,7 @@ PGSemaphoreCreate(PGSemaphore sema)
 	{
 		/* Time to allocate another semaphore set */
 		if (numSemaSets >= maxSemaSets)
-			elog(PANIC, "PGSemaphoreCreate: too many semaphores created");
+			elog(PANIC, "too many semaphores created");
 		mySemaSets[numSemaSets] = IpcSemaphoreCreate(SEMAS_PER_SET);
 		numSemaSets++;
 		nextSemaNumber = 0;
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 8d6a1814ecb..cccfe22d5a5 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.11 2003/07/14 20:00:22 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.12 2003/07/22 23:30:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -181,7 +181,7 @@ IpcMemoryDetach(int status, Datum shmaddr)
 				DatumGetPointer(shmaddr), strerror(errno));
 
 	/*
-	 * We used to report a failure via elog(WARNING), but that's pretty
+	 * We used to report a failure via ereport(WARNING), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
@@ -198,7 +198,7 @@ IpcMemoryDelete(int status, Datum shmId)
 				DatumGetInt32(shmId), IPC_RMID, strerror(errno));
 
 	/*
-	 * We used to report a failure via elog(WARNING), but that's pretty
+	 * We used to report a failure via ereport(WARNING), but that's pretty
 	 * pointless considering any client has long since disconnected ...
 	 */
 }
-- 
GitLab