Attached is a patch that makes the message strings used in elogs and
ereports more consistent with the style guidelines: errdetail should
begin with a capital letter and end with a period, whereas errmsg should
not. Most of the corrections are for contrib/, although the patch also
fixes a few mistakes in the main tree.

Barring any objections, I'll apply this tomorrow.

-Neil

============================================================
*** contrib/cube/cubeparse.y	04c791d8497bb0c9f81f04640e76e4a91d526854
--- contrib/cube/cubeparse.y	28999358502ba57f55251e5e8eb43812d2dbc856
***************
*** 44,50 ****
            ereport(ERROR,
                    (errcode(ERRCODE_SYNTAX_ERROR),
                     errmsg("bad cube representation"),
!                    errdetail("different point dimensions in (%s) and (%s)",
                               $2, $4)));
  	      YYABORT;
  	    }
--- 44,50 ----
            ereport(ERROR,
                    (errcode(ERRCODE_SYNTAX_ERROR),
                     errmsg("bad cube representation"),
!                    errdetail("Different point dimensions in (%s) and (%s).",
                               $2, $4)));
  	      YYABORT;
  	    }
***************
*** 52,59 ****
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("more than %d dimensions",
!                                  CUBE_MAX_DIM)));
                YYABORT;
              }
  	    
--- 52,59 ----
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("A cube cannot have more than %d dimensions.",
! 								 CUBE_MAX_DIM)));
                YYABORT;
              }
  	    
***************
*** 70,76 ****
            ereport(ERROR,
                    (errcode(ERRCODE_SYNTAX_ERROR),
                     errmsg("bad cube representation"),
!                    errdetail("different point dimensions in (%s) and (%s)",
                               $1, $3)));
  	      YYABORT;
  	    }
--- 70,76 ----
            ereport(ERROR,
                    (errcode(ERRCODE_SYNTAX_ERROR),
                     errmsg("bad cube representation"),
!                    errdetail("Different point dimensions in (%s) and (%s).",
                               $1, $3)));
  	      YYABORT;
  	    }
***************
*** 78,84 ****
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("more than %d dimensions",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
--- 78,84 ----
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("A cube cannot have more than %d dimensions.",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
***************
*** 95,101 ****
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("more than %d dimensions",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
--- 95,101 ----
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("A cube cannot have more than %d dimensions.",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
***************
*** 113,119 ****
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("more than %d dimensions",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
--- 113,119 ----
                ereport(ERROR,
                        (errcode(ERRCODE_SYNTAX_ERROR),
                         errmsg("bad cube representation"),
!                        errdetail("A cube cannot have more than %d dimensions.",
                                   CUBE_MAX_DIM)));
                YYABORT;
              }
***************
*** 187,193 ****
  }
  
  
! static NDBOX * write_point_as_box(char *str, int dim)
  {
    NDBOX * bp;
    int i, size;
--- 187,194 ----
  }
  
  
! static NDBOX *
! write_point_as_box(char *str, int dim)
  {
    NDBOX * bp;
    int i, size;
============================================================
*** contrib/intarray/_int_gist.c	6c29534cb1f089e16ff9e19f80c2d6f7b60b9abf
--- contrib/intarray/_int_gist.c	3cf1d3960f9ce049f7ea0da3c5627f1e410b26d2
***************
*** 144,150 ****
  		PREPAREARR(r);
  
  		if (ARRNELEMS(r) >= 2 * MAXNUMRANGE)
! 			elog(NOTICE, "Input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
  				 2 * MAXNUMRANGE - 1, ARRNELEMS(r));
  
  		retval = palloc(sizeof(GISTENTRY));
--- 144,150 ----
  		PREPAREARR(r);
  
  		if (ARRNELEMS(r) >= 2 * MAXNUMRANGE)
! 			elog(NOTICE, "input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
  				 2 * MAXNUMRANGE - 1, ARRNELEMS(r));
  
  		retval = palloc(sizeof(GISTENTRY));
============================================================
*** contrib/isbn_issn/isbn_issn.c	aa2c7d2a4cb22fb75c0fb8ce46544719320c1221
--- contrib/isbn_issn/isbn_issn.c	f2682aff1e2499c343478abdd30a6617fac0c2f5
***************
*** 45,72 ****
  isbn_in(char *str)
  {
  	isbn	   *result;
  
! 	if (strlen(str) != 13)
! 	{
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISBN: \"%s\"", str),
! 				 errdetail("incorrect length")));
  
- 		return (NULL);
- 	}
  	if (isbn_sum(str) != 0)
- 	{
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISBN: \"%s\"", str),
! 				 errdetail("failed checksum")));
! 		return (NULL);
! 	}
  
  	result = (isbn *) palloc(sizeof(isbn));
! 
! 	strncpy(result->num, str, 13);
  	memset(result->pad, ' ', 3);
  	return (result);
  }
--- 45,67 ----
  isbn_in(char *str)
  {
  	isbn	   *result;
+ 	int			len;
  
! 	len = strlen(str);
! 	if (len != 13)
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISBN: \"%s\"", str),
! 				 errdetail("ISBNs must be 13 characters in length.")));
  
  	if (isbn_sum(str) != 0)
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISBN: \"%s\"", str),
! 				 errdetail("ISBN failed checksum.")));
  
  	result = (isbn *) palloc(sizeof(isbn));
! 	memcpy(result->num, str, len);
  	memset(result->pad, ' ', 3);
  	return (result);
  }
***************
*** 239,266 ****
  issn_in(char *str)
  {
  	issn	   *result;
  
! 	if (strlen(str) != 9)
! 	{
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISSN: \"%s\"", str),
! 				 errdetail("incorrect length")));
  
- 		return (NULL);
- 	}
  	if (issn_sum(str) != 0)
- 	{
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISSN: \"%s\"", str),
! 				 errdetail("failed checksum")));
! 		return (NULL);
! 	}
  
  	result = (issn *) palloc(sizeof(issn));
! 
! 	strncpy(result->num, str, 9);
  	memset(result->pad, ' ', 7);
  	return (result);
  }
--- 234,256 ----
  issn_in(char *str)
  {
  	issn	   *result;
+ 	int			len;
  
! 	len = strlen(str);
! 	if (len != 9)
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISSN: \"%s\"", str),
! 				 errdetail("ISSNs must be 9 characters in length.")));
  
  	if (issn_sum(str) != 0)
  		ereport(ERROR,
  				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
  				 errmsg("invalid ISSN: \"%s\"", str),
! 				 errdetail("ISSN failed checksum.")));
  
  	result = (issn *) palloc(sizeof(issn));
! 	memcpy(result->num, str, len);
  	memset(result->pad, ' ', 7);
  	return (result);
  }
============================================================
*** contrib/ltree/ltree_io.c	690d56165674a354093a0eff03035627ea58f410
--- contrib/ltree/ltree_io.c	8707ace3f390f01207436f444fbcfc92a92633fa
***************
*** 80,87 ****
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("name length is %d, must " \
! 									   "be < 256, in position %d",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
--- 80,87 ----
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("Name length is %d, must "
! 									   "be < 256, in position %d.",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
***************
*** 104,111 ****
  			ereport(ERROR,
  					(errcode(ERRCODE_NAME_TOO_LONG),
  					 errmsg("name of level is too long"),
! 					 errdetail("name length is %d, must " \
! 							   "be < 256, in position %d",
  							   lptr->len, (int) (lptr->start - buf))));
  
  		totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
--- 104,111 ----
  			ereport(ERROR,
  					(errcode(ERRCODE_NAME_TOO_LONG),
  					 errmsg("name of level is too long"),
! 					 errdetail("Name length is %d, must "
! 							   "be < 256, in position %d.",
  							   lptr->len, (int) (lptr->start - buf))));
  
  		totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
***************
*** 282,289 ****
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("name length is %d, must " \
! 									   "be < 256, in position %d",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				state = LQPRS_WAITVAR;
--- 282,289 ----
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("Name length is %d, must "
! 									   "be < 256, in position %d.",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				state = LQPRS_WAITVAR;
***************
*** 298,305 ****
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("name length is %d, must " \
! 									   "be < 256, in position %d",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				state = LQPRS_WAITLEVEL;
--- 298,305 ----
  					ereport(ERROR,
  							(errcode(ERRCODE_NAME_TOO_LONG),
  							 errmsg("name of level is too long"),
! 							 errdetail("Name length is %d, must "
! 									   "be < 256, in position %d.",
  									 lptr->len, (int) (lptr->start - buf))));
  
  				state = LQPRS_WAITLEVEL;
***************
*** 411,418 ****
  			ereport(ERROR,
  					(errcode(ERRCODE_NAME_TOO_LONG),
  					 errmsg("name of level is too long"),
! 					 errdetail("name length is %d, must " \
! 							   "be < 256, in position %d",
  							   lptr->len, (int) (lptr->start - buf))));
  	}
  	else if (state == LQPRS_WAITOPEN)
--- 411,418 ----
  			ereport(ERROR,
  					(errcode(ERRCODE_NAME_TOO_LONG),
  					 errmsg("name of level is too long"),
! 					 errdetail("Name length is %d, must "
! 							   "be < 256, in position %d.",
  							   lptr->len, (int) (lptr->start - buf))));
  	}
  	else if (state == LQPRS_WAITOPEN)
============================================================
*** contrib/pg_trgm/trgm_gist.c	c1845694b5ae245f3c875895230855cd130bd58a
--- contrib/pg_trgm/trgm_gist.c	6a0ececb97ad9392d621585debf2379b85fb951f
***************
*** 60,66 ****
  Datum
  gtrgm_in(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "Not implemented");
  	PG_RETURN_DATUM(0);
  }
  
--- 60,66 ----
  Datum
  gtrgm_in(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "not implemented");
  	PG_RETURN_DATUM(0);
  }
  
***************
*** 67,73 ****
  Datum
  gtrgm_out(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "Not implemented");
  	PG_RETURN_DATUM(0);
  }
  
--- 67,73 ----
  Datum
  gtrgm_out(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "not implemented");
  	PG_RETURN_DATUM(0);
  }
  
============================================================
*** contrib/pg_trgm/trgm_op.c	0c43a2fddc3723f449bf892594510432e23d8098
--- contrib/pg_trgm/trgm_op.c	7f9e9275218715b403fe3b6a1b36a95af6086ce1
***************
*** 13,19 ****
  	float4		nlimit = PG_GETARG_FLOAT4(0);
  
  	if (nlimit < 0 || nlimit > 1.0)
! 		elog(ERROR, "Wrong limit, should be between 0 and 1");
  	trgm_limit = nlimit;
  	PG_RETURN_FLOAT4(trgm_limit);
  }
--- 13,19 ----
  	float4		nlimit = PG_GETARG_FLOAT4(0);
  
  	if (nlimit < 0 || nlimit > 1.0)
! 		elog(ERROR, "wrong limit, should be between 0 and 1");
  	trgm_limit = nlimit;
  	PG_RETURN_FLOAT4(trgm_limit);
  }
============================================================
*** contrib/tablefunc/tablefunc.c	ec0ff1857e0f769090c87ad659dad5005be3721c
--- contrib/tablefunc/tablefunc.c	e070edbdcf67988763059627fbbf6ce736b813e1
***************
*** 894,902 ****
  			ereport(ERROR,
  					(errcode(ERRCODE_SYNTAX_ERROR),
  					 errmsg("invalid return type"),
! 					 errdetail("query-specified return " \
  							   "tuple has %d columns but crosstab " \
! 							   "returns %d", tupdesc->natts, result_ncols)));
  
  		/* allocate space */
  		values = (char **) palloc(result_ncols * sizeof(char *));
--- 894,902 ----
  			ereport(ERROR,
  					(errcode(ERRCODE_SYNTAX_ERROR),
  					 errmsg("invalid return type"),
! 					 errdetail("Query-specified return " \
  							   "tuple has %d columns but crosstab " \
! 							   "returns %d.", tupdesc->natts, result_ncols)));
  
  		/* allocate space */
  		values = (char **) palloc(result_ncols * sizeof(char *));
***************
*** 1531,1542 ****
  
  	/* check that the type of the fifth column is INT4 */
  	if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID)
! 		elog(ERROR, "Query-specified return tuple not valid for Connectby: "
  			 "fifth column must be type %s", format_type_be(INT4OID));
  
  	/* check that the type of the fifth column is INT4 */
  	if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID)
! 		elog(ERROR, "Query-specified return tuple not valid for Connectby: "
  			 "fourth column must be type %s", format_type_be(INT4OID));
  
  	/* OK, the tupdesc is valid for our purposes */
--- 1531,1542 ----
  
  	/* check that the type of the fifth column is INT4 */
  	if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID)
! 		elog(ERROR, "query-specified return tuple not valid for Connectby: "
  			 "fifth column must be type %s", format_type_be(INT4OID));
  
  	/* check that the type of the fifth column is INT4 */
  	if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID)
! 		elog(ERROR, "query-specified return tuple not valid for Connectby: "
  			 "fourth column must be type %s", format_type_be(INT4OID));
  
  	/* OK, the tupdesc is valid for our purposes */
============================================================
*** contrib/tsearch2/ispell/spell.c	c4e2bfebbb657ef770e6ace1066350be12d23b57
--- contrib/tsearch2/ispell/spell.c	52f749aa6fc7636c45a042988c08d7c687969537
***************
*** 869,875 ****
  				char		regerrstr[ERRSTRSIZE];
  
  				pg_regerror(err, &(Affix->reg.regex), regerrstr, ERRSTRSIZE);
! 				elog(ERROR, "Regex error in '%s': %s", Affix->mask, regerrstr);
  			}
  			Affix->compile = 0;
  		}
--- 869,875 ----
  				char		regerrstr[ERRSTRSIZE];
  
  				pg_regerror(err, &(Affix->reg.regex), regerrstr, ERRSTRSIZE);
! 				elog(ERROR, "regex error in '%s': %s", Affix->mask, regerrstr);
  			}
  			Affix->compile = 0;
  		}
============================================================
*** contrib/tsearch2/prs_dcfg.c	b955933ad1f22aae0b9dc1c4d106e126e529aca1
--- contrib/tsearch2/prs_dcfg.c	8e5f47b17c69c967e0882c739b4c2a789baa4a9f
***************
*** 74,80 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_INKEY)
--- 74,80 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d.",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_INKEY)
***************
*** 93,99 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_WAITEQ)
--- 93,99 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d.",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_WAITEQ)
***************
*** 104,110 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_WAITVALUE)
--- 104,110 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d.",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_WAITVALUE)
***************
*** 150,156 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_INESC)
--- 150,156 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_SYNTAX_ERROR),
  						 errmsg("syntax error"),
! 						 errdetail("Syntax error in position %d.",
  								   (int) (ptr - VARDATA(in)))));
  		}
  		else if (state == CS_INESC)
***************
*** 161,167 ****
  			ereport(ERROR,
  					(errcode(ERRCODE_SYNTAX_ERROR),
  					 errmsg("bad parser state"),
! 					 errdetail("%d at position %d",
  							   state, (int) (ptr - VARDATA(in)))));
  		ptr+=pg_mblen(ptr);
  	}
--- 161,167 ----
  			ereport(ERROR,
  					(errcode(ERRCODE_SYNTAX_ERROR),
  					 errmsg("bad parser state"),
! 					 errdetail("%d at position %d.",
  							   state, (int) (ptr - VARDATA(in)))));
  		ptr+=pg_mblen(ptr);
  	}
============================================================
*** contrib/tsearch2/query.c	79156d009f8c676f664a429d7dba48d49cef2493
--- contrib/tsearch2/query.c	074a990e5f8057fccde994cd5c3e499166a8fd29
***************
*** 643,649 ****
  	pfree(state.valstate.word);
  	if (!state.num)
  	{
! 		elog(NOTICE, "Query doesn't contain lexem(s)");
  		query = (QUERYTYPE *) palloc(HDRSIZEQT);
  		query->len = HDRSIZEQT;
  		query->size = 0;
--- 643,649 ----
  	pfree(state.valstate.word);
  	if (!state.num)
  	{
! 		elog(NOTICE, "query doesn't contain lexem(s)");
  		query = (QUERYTYPE *) palloc(HDRSIZEQT);
  		query->len = HDRSIZEQT;
  		query->size = 0;
============================================================
*** contrib/tsearch2/query_cleanup.c	7a53b7f982f88c5266a15593cae6e35635b2e223
--- contrib/tsearch2/query_cleanup.c	b4346801c13c8a903031b1cbc0329a49440f57d2
***************
*** 246,252 ****
  	resroot = clean_fakeval_intree(root, &result);
  	if (result != V_UNKNOWN)
  	{
! 		elog(NOTICE, "Query contains only stopword(s) or doesn't contain lexem(s), ignored");
  		*len = 0;
  		return NULL;
  	}
--- 246,252 ----
  	resroot = clean_fakeval_intree(root, &result);
  	if (result != V_UNKNOWN)
  	{
! 		elog(NOTICE, "query contains only stopword(s) or doesn't contain lexem(s), ignored");
  		*len = 0;
  		return NULL;
  	}
============================================================
*** contrib/tsearch2/query_gist.c	7cbf289f9530e1cf8b2d17b534e5fcf4a6bd6a8c
--- contrib/tsearch2/query_gist.c	83c5344822dcf0d2ba969125b563d4e9bcc0654e
***************
*** 138,144 ****
  Datum
  gtsq_in(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "Not implemented");
  	PG_RETURN_DATUM(0);
  }
  
--- 138,144 ----
  Datum
  gtsq_in(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "not implemented");
  	PG_RETURN_DATUM(0);
  }
  
***************
*** 145,151 ****
  Datum
  gtsq_out(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "Not implemented");
  	PG_RETURN_DATUM(0);
  }
  
--- 145,151 ----
  Datum
  gtsq_out(PG_FUNCTION_ARGS)
  {
! 	elog(ERROR, "not implemented");
  	PG_RETURN_DATUM(0);
  }
  
============================================================
*** contrib/tsearch2/query_rewrite.c	7903de0a5082c96a585accd41dc551361a8a8b9d
--- contrib/tsearch2/query_rewrite.c	9f5c698adac470be52fd89bf048b9937c0c742ce
***************
*** 220,226 ****
  
  	if (SPI_processed < 0)
  		/* internal error */
! 		elog(ERROR, "There is no tsvector type");
  	tsqOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
  	if (tsqOid == InvalidOid)
  		/* internal error */
--- 220,226 ----
  
  	if (SPI_processed < 0)
  		/* internal error */
! 		elog(ERROR, "there is no tsvector type");
  	tsqOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
  	if (tsqOid == InvalidOid)
  		/* internal error */
============================================================
*** contrib/tsearch2/rewrite.c	ea2fc8d8a6405346f63f8a529e65551786e792f3
--- contrib/tsearch2/rewrite.c	d50512cae1daebd62a934cd273566c91e6ae2041
***************
*** 250,256 ****
  	resroot = clean_fakeval_intree(root, &result);
  	if (result != V_UNKNOWN)
  	{
! 		elog(NOTICE, "Query contains only stopword(s) or doesn't contain lexem(s), ignored");
  		*len = 0;
  		return NULL;
  	}
--- 250,256 ----
  	resroot = clean_fakeval_intree(root, &result);
  	if (result != V_UNKNOWN)
  	{
! 		elog(NOTICE, "query contains only stopword(s) or doesn't contain lexem(s), ignored");
  		*len = 0;
  		return NULL;
  	}
============================================================
*** contrib/tsearch2/ts_stat.c	2775c7a7f0a35cea82d1a03ea9d38941399013c1
--- contrib/tsearch2/ts_stat.c	a41efa02cc69e8d578b155bf4221612bde5d12f9
***************
*** 426,432 ****
  
  	if (SPI_processed < 1)
  		/* internal error */
! 		elog(ERROR, "There is no tsvector type");
  	tiOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
  	if (tiOid == InvalidOid)
  		/* internal error */
--- 426,432 ----
  
  	if (SPI_processed < 1)
  		/* internal error */
! 		elog(ERROR, "there is no tsvector type");
  	tiOid = DatumGetObjectId(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
  	if (tiOid == InvalidOid)
  		/* internal error */
============================================================
*** contrib/xml2/xpath.c	20bc45f075a2db3b7aa8bcb43dea7f656d9effbc
--- contrib/xml2/xpath.c	33431d690cd771b9011c538bbd06ae814adf2cea
***************
*** 600,606 ****
  			break;
  
  		default:
! 			elog(NOTICE, "Unsupported XQuery result: %d", res->type);
  			xpresstr = xmlStrdup("<unsupported/>");
  	}
  
--- 600,606 ----
  			break;
  
  		default:
! 			elog(NOTICE, "unsupported XQuery result: %d", res->type);
  			xpresstr = xmlStrdup("<unsupported/>");
  	}
  
***************
*** 781,788 ****
  	if (spi_tupdesc->natts != 2)
  	{
  		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
! 						errmsg("Expression returning multiple columns is not valid in parameter list"),
! 						errdetail("Expected two columns in SPI result, got %d", spi_tupdesc->natts)));
  	}
  
  /* Setup the parser. Beware that this must happen in the same context as the
--- 781,788 ----
  	if (spi_tupdesc->natts != 2)
  	{
  		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
! 						errmsg("expression returning multiple columns is not valid in parameter list"),
! 						errdetail("Expected two columns in SPI result, got %d.", spi_tupdesc->natts)));
  	}
  
  /* Setup the parser. Beware that this must happen in the same context as the
***************
*** 890,896 ****
  								break;
  
  							default:
! 								elog(NOTICE, "Unsupported XQuery result: %d", res->type);
  								resstr = xmlStrdup("<unsupported/>");
  						}
  
--- 890,896 ----
  								break;
  
  							default:
! 								elog(NOTICE, "unsupported XQuery result: %d", res->type);
  								resstr = xmlStrdup("<unsupported/>");
  						}
  
============================================================
*** contrib/xml2/xslt_proc.c	a33ed068704963b8ac623819b48253958ab3c56e
--- contrib/xml2/xslt_proc.c	65ea4959e35918c856af2f24a3dd3e93073fe393
***************
*** 81,87 ****
  	if (doctree == NULL)
  	{
  		xmlCleanupParser();
! 		elog_error(ERROR, "Error parsing XML document", 0);
  
  		PG_RETURN_NULL();
  	}
--- 81,87 ----
  	if (doctree == NULL)
  	{
  		xmlCleanupParser();
! 		elog_error(ERROR, "error parsing XML document", 0);
  
  		PG_RETURN_NULL();
  	}
***************
*** 95,101 ****
  		{
  			xmlFreeDoc(doctree);
  			xmlCleanupParser();
! 			elog_error(ERROR, "Error parsing stylesheet as XML document", 0);
  			PG_RETURN_NULL();
  		}
  
--- 95,101 ----
  		{
  			xmlFreeDoc(doctree);
  			xmlCleanupParser();
! 			elog_error(ERROR, "error parsing stylesheet as XML document", 0);
  			PG_RETURN_NULL();
  		}
  
***************
*** 110,116 ****
  		xmlFreeDoc(doctree);
  		xsltCleanupGlobals();
  		xmlCleanupParser();
! 		elog_error(ERROR, "Failed to parse stylesheet", 0);
  		PG_RETURN_NULL();
  	}
  
--- 110,116 ----
  		xmlFreeDoc(doctree);
  		xsltCleanupGlobals();
  		xmlCleanupParser();
! 		elog_error(ERROR, "failed to parse stylesheet", 0);
  		PG_RETURN_NULL();
  	}
  
============================================================
*** doc/src/sgml/plperl.sgml	6f8fb3ab5f088a071834f05aed5554c1abfbdca5
--- doc/src/sgml/plperl.sgml	79bcffe394126707517c17c43c6623776add6079
***************
*** 399,405 ****
      my $t = localtime;
      elog(NOTICE, "opening file $file at $t" );
      open my $fh, '&lt;', $file # ooh, it's a file access!
!         or elog(ERROR, "Can't open $file for reading: $!");
      my @words = &lt;$fh&gt;;
      close $fh;
      $t = localtime;
--- 399,405 ----
      my $t = localtime;
      elog(NOTICE, "opening file $file at $t" );
      open my $fh, '&lt;', $file # ooh, it's a file access!
!         or elog(ERROR, "can't open $file for reading: $!");
      my @words = &lt;$fh&gt;;
      close $fh;
      $t = localtime;
***************
*** 556,564 ****
  CREATE FUNCTION badfunc() RETURNS integer AS $$
      my $tmpfile = "/tmp/badfile";
      open my $fh, '&gt;', $tmpfile
!         or elog(ERROR, qq{Could not open the file "$tmpfile": $!});
      print $fh "Testing writing to a file\n";
!     close $fh or elog(ERROR, qq{Could not close the file "$tmpfile": $!});
      return 1;
  $$ LANGUAGE plperl;
  </programlisting>
--- 556,564 ----
  CREATE FUNCTION badfunc() RETURNS integer AS $$
      my $tmpfile = "/tmp/badfile";
      open my $fh, '&gt;', $tmpfile
!         or elog(ERROR, qq{could not open the file "$tmpfile": $!});
      print $fh "Testing writing to a file\n";
!     close $fh or elog(ERROR, qq{could not close the file "$tmpfile": $!});
      return 1;
  $$ LANGUAGE plperl;
  </programlisting>
============================================================
*** src/backend/access/transam/slru.c	de1f6d38ab5e9b1b08c7e04e7da2a1684f6a0924
--- src/backend/access/transam/slru.c	bb39e8e492a8bd2d6db649812fbd8703d2a21c4d
***************
*** 752,759 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("could not open file \"%s\": %m",
! 							   path)));
  			break;
  		case SLRU_SEEK_FAILED:
  			ereport(ERROR,
--- 752,758 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("Could not open file \"%s\": %m.", path)));
  			break;
  		case SLRU_SEEK_FAILED:
  			ereport(ERROR,
***************
*** 759,765 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				  errdetail("could not seek in file \"%s\" to offset %u: %m",
  							path, offset)));
  			break;
  		case SLRU_READ_FAILED:
--- 758,764 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				  errdetail("Could not seek in file \"%s\" to offset %u: %m.",
  							path, offset)));
  			break;
  		case SLRU_READ_FAILED:
***************
*** 766,772 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				errdetail("could not read from file \"%s\" at offset %u: %m",
  						  path, offset)));
  			break;
  		case SLRU_WRITE_FAILED:
--- 765,771 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				errdetail("Could not read from file \"%s\" at offset %u: %m.",
  						  path, offset)));
  			break;
  		case SLRU_WRITE_FAILED:
***************
*** 773,779 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				 errdetail("could not write to file \"%s\" at offset %u: %m",
  						   path, offset)));
  			break;
  		case SLRU_FSYNC_FAILED:
--- 772,778 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 				 errdetail("Could not write to file \"%s\" at offset %u: %m.",
  						   path, offset)));
  			break;
  		case SLRU_FSYNC_FAILED:
***************
*** 780,786 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("could not fsync file \"%s\": %m",
  							   path)));
  			break;
  		case SLRU_CLOSE_FAILED:
--- 779,785 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("Could not fsync file \"%s\": %m.",
  							   path)));
  			break;
  		case SLRU_CLOSE_FAILED:
***************
*** 787,793 ****
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("could not close file \"%s\": %m",
  							   path)));
  			break;
  		default:
--- 786,792 ----
  			ereport(ERROR,
  					(errcode_for_file_access(),
  					 errmsg("could not access status of transaction %u", xid),
! 					 errdetail("Could not close file \"%s\": %m.",
  							   path)));
  			break;
  		default:
============================================================
*** src/backend/port/sysv_shmem.c	14aa9d42b0a5c6eeaca6fbedb1f6fb266cb29eb1
--- src/backend/port/sysv_shmem.c	d29f7a3138c4a84a85ab553e8f0abcf154b6a374
***************
*** 426,432 ****
  	UsedShmemSegAddr = origUsedShmemSegAddr;
  #endif
  
! 	elog(DEBUG3, "Attaching to %p", UsedShmemSegAddr);
  	hdr = (void *) PGSharedMemoryAttach((IpcMemoryKey) UsedShmemSegID, &shmid);
  	if (hdr == NULL)
  		elog(FATAL, "could not reattach to shared memory (key=%d, addr=%p): %m",
--- 426,432 ----
  	UsedShmemSegAddr = origUsedShmemSegAddr;
  #endif
  
! 	elog(DEBUG3, "attaching to %p", UsedShmemSegAddr);
  	hdr = (void *) PGSharedMemoryAttach((IpcMemoryKey) UsedShmemSegID, &shmid);
  	if (hdr == NULL)
  		elog(FATAL, "could not reattach to shared memory (key=%d, addr=%p): %m",
============================================================
*** src/pl/plpython/plpython.c	1c65898abe9b77f914f5297324554136399cebea
--- src/pl/plpython/plpython.c	c3f02616a734b755494f023630ea8695deae34d9
***************
*** 404,410 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_DATA_EXCEPTION),
  						 errmsg("unexpected return value from trigger procedure"),
! 						 errdetail("expected None or a String")));
  
  			srv = PyString_AsString(plrv);
  			if (pg_strcasecmp(srv, "SKIP") == 0)
--- 404,410 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_DATA_EXCEPTION),
  						 errmsg("unexpected return value from trigger procedure"),
! 						 errdetail("Expected None or a String.")));
  
  			srv = PyString_AsString(plrv);
  			if (pg_strcasecmp(srv, "SKIP") == 0)
***************
*** 428,434 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_DATA_EXCEPTION),
  						 errmsg("unexpected return value from trigger procedure"),
! 						 errdetail("expected None, \"OK\", \"SKIP\", or \"MODIFY\"")));
  			}
  		}
  	}
--- 428,434 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_DATA_EXCEPTION),
  						 errmsg("unexpected return value from trigger procedure"),
! 						 errdetail("Expected None, \"OK\", \"SKIP\", or \"MODIFY\".")));
  			}
  		}
  	}
***************
*** 770,776 ****
  				ereport(ERROR,
  						(errcode(ERRCODE_DATATYPE_MISMATCH),
  						 errmsg("invalid return value from plpython function"),
! 						 errdetail("Functions returning type \"void\" must return \"None\".")));
  
  			fcinfo->isnull = false;
  			rv = (Datum) 0;
--- 770,776 ----
  				ereport(ERROR,
  						(errcode(ERRCODE_DATATYPE_MISMATCH),
  						 errmsg("invalid return value from plpython function"),
! 						 errdetail("Functions returning type \"void\" must return None.")));
  
  			fcinfo->isnull = false;
  			rv = (Datum) 0;
============================================================
*** src/tutorial/beard.c	6a73dd717888cbd6d17296f674b936011e9f81d3
--- src/tutorial/beard.c	a0f455e89a3ef52f7180b7db7bd82bea34deda8d
***************
*** 38,47 ****
  											   ObjectIdGetDatum(picture),
  											   Int32GetDatum(INV_READ)));
  	if (pic_fd < 0)
! 		elog(ERROR, "Cannot access picture large object");
  
  	if (lo_read(pic_fd, (char *) &ihdr, sizeof(ihdr)) != sizeof(ihdr))
! 		elog(ERROR, "Picture large object corrupted");
  
  	beardOffset = (ihdr.size / 3) * 2;
  
--- 38,47 ----
  											   ObjectIdGetDatum(picture),
  											   Int32GetDatum(INV_READ)));
  	if (pic_fd < 0)
! 		elog(ERROR, "cannot access picture large object");
  
  	if (lo_read(pic_fd, (char *) &ihdr, sizeof(ihdr)) != sizeof(ihdr))
! 		elog(ERROR, "picture large object corrupted");
  
  	beardOffset = (ihdr.size / 3) * 2;
  
***************
*** 51,69 ****
  	beard = DatumGetObjectId(DirectFunctionCall1(lo_creat,
  												 Int32GetDatum(INV_MD)));
  	if (beard == InvalidOid)
! 		elog(ERROR, "Cannot create new large object");
  
  	beard_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
  												 ObjectIdGetDatum(beard),
  												 Int32GetDatum(INV_WRITE)));
  	if (beard_fd < 0)
! 		elog(ERROR, "Cannot access beard large object");
  
  	if (DatumGetInt32(DirectFunctionCall3(lo_lseek,
  										  Int32GetDatum(pic_fd),
  										  Int32GetDatum(beardOffset),
  										  Int32GetDatum(SEEK_SET))) < 0)
! 		elog(ERROR, "Cannot seek in picture large object");
  
  	while ((cc = lo_read(pic_fd, buf, BUFSIZE)) > 0)
  	{
--- 51,69 ----
  	beard = DatumGetObjectId(DirectFunctionCall1(lo_creat,
  												 Int32GetDatum(INV_MD)));
  	if (beard == InvalidOid)
! 		elog(ERROR, "cannot create new large object");
  
  	beard_fd = DatumGetInt32(DirectFunctionCall2(lo_open,
  												 ObjectIdGetDatum(beard),
  												 Int32GetDatum(INV_WRITE)));
  	if (beard_fd < 0)
! 		elog(ERROR, "cannot access beard large object");
  
  	if (DatumGetInt32(DirectFunctionCall3(lo_lseek,
  										  Int32GetDatum(pic_fd),
  										  Int32GetDatum(beardOffset),
  										  Int32GetDatum(SEEK_SET))) < 0)
! 		elog(ERROR, "cannot seek in picture large object");
  
  	while ((cc = lo_read(pic_fd, buf, BUFSIZE)) > 0)
  	{
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to