mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Error message editing in contrib (mostly by Joe Conway --- thanks Joe!)
This commit is contained in:
@ -6,8 +6,6 @@
|
||||
#include "access/itup.h"
|
||||
#include "access/rtree.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/elog.h"
|
||||
#include "utils/palloc.h"
|
||||
#include "utils/array.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "storage/bufpage.h"
|
||||
@ -34,7 +32,11 @@
|
||||
#define ARRPTR(x) ( (int4 *) ARR_DATA_PTR(x) )
|
||||
#define ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))
|
||||
|
||||
#define ARRISVOID(x) ( (x) ? ( ( ARR_NDIM(x) == NDIM ) ? ( ( ARRNELEMS( x ) ) ? 0 : 1 ) : ( ( ARR_NDIM(x) ) ? (elog(ERROR,"Array is not one-dimensional: %d dimensions",ARRNELEMS( x )),1) : 0 ) ) : 0 )
|
||||
#define ARRISVOID(x) ( (x) ? ( ( ARR_NDIM(x) == NDIM ) ? ( ( ARRNELEMS( x ) ) ? 0 : 1 ) : ( ( ARR_NDIM(x) ) ? ( \
|
||||
ereport(ERROR, \
|
||||
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), \
|
||||
errmsg("array must be one-dimensional, not %d dimensions", ARRNELEMS( x )))) \
|
||||
,1) : 0 ) ) : 0 )
|
||||
|
||||
#define SORT(x) \
|
||||
do { \
|
||||
|
@ -177,7 +177,9 @@ makepol(WORKSTATE * state)
|
||||
else
|
||||
{
|
||||
if (lenstack == STACKDEPTH)
|
||||
elog(ERROR, "Stack too short");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
|
||||
errmsg("statement too complex")));
|
||||
stack[lenstack] = val;
|
||||
lenstack++;
|
||||
}
|
||||
@ -202,7 +204,9 @@ makepol(WORKSTATE * state)
|
||||
break;
|
||||
case ERR:
|
||||
default:
|
||||
elog(ERROR, "Syntax error");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("syntax error")));
|
||||
return ERR;
|
||||
|
||||
}
|
||||
@ -359,7 +363,7 @@ findoprnd(ITEM * ptr, int4 *pos)
|
||||
{
|
||||
#ifdef BS_DEBUG
|
||||
elog(DEBUG3, (ptr[*pos].type == OPR) ?
|
||||
"%d %c" : "%d %d ", *pos, ptr[*pos].val);
|
||||
"%d %c" : "%d %d", *pos, ptr[*pos].val);
|
||||
#endif
|
||||
if (ptr[*pos].type == VAL)
|
||||
{
|
||||
@ -413,7 +417,9 @@ bqarr_in(PG_FUNCTION_ARGS)
|
||||
/* make polish notation (postfix, but in reverse order) */
|
||||
makepol(&state);
|
||||
if (!state.num)
|
||||
elog(ERROR, "Empty query");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("empty query")));
|
||||
|
||||
commonlen = COMPUTESIZE(state.num);
|
||||
query = (QUERYTYPE *) palloc(commonlen);
|
||||
@ -548,7 +554,10 @@ bqarr_out(PG_FUNCTION_ARGS)
|
||||
INFIX nrm;
|
||||
|
||||
if (query->size == 0)
|
||||
elog(ERROR, "Empty");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("empty query")));
|
||||
|
||||
nrm.curpol = GETQUERY(query) + query->size - 1;
|
||||
nrm.buflen = 32;
|
||||
nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
|
||||
@ -703,7 +712,9 @@ querytree(PG_FUNCTION_ARGS)
|
||||
int4 len;
|
||||
|
||||
if (query->size == 0)
|
||||
elog(ERROR, "Empty");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("empty query")));
|
||||
|
||||
q = (ITEM *) palloc(sizeof(ITEM) * query->size);
|
||||
memcpy((void *) q, GETQUERY(query), sizeof(ITEM) * query->size);
|
||||
|
@ -243,7 +243,9 @@ sort(PG_FUNCTION_ARGS)
|
||||
&& (d[3] == 'C' || d[3] == 'c'))
|
||||
dir = 0;
|
||||
if (dir == -1)
|
||||
elog(ERROR, "Invalid second parameter in function sort. It must be 'ASC' or 'DESC'.");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("second parameter must be \"ASC\" or \"DESC\"")));
|
||||
QSORT(a, dir);
|
||||
PG_RETURN_POINTER(a);
|
||||
}
|
||||
|
@ -40,13 +40,17 @@ Datum _intbig_out(PG_FUNCTION_ARGS);
|
||||
|
||||
Datum
|
||||
_intbig_in(PG_FUNCTION_ARGS) {
|
||||
elog(ERROR, "Not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("_intbig_in() not implemented")));
|
||||
PG_RETURN_DATUM(0);
|
||||
}
|
||||
|
||||
Datum
|
||||
_intbig_out(PG_FUNCTION_ARGS) {
|
||||
elog(ERROR, "Not implemented");
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("_intbig_out() not implemented")));
|
||||
PG_RETURN_DATUM(0);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
--
|
||||
-- first, define the datatype. Turn off echoing so that expected file
|
||||
-- does not depend on contents of seg.sql.
|
||||
-- does not depend on contents of _int.sql.
|
||||
--
|
||||
\set ECHO none
|
||||
psql:_int.sql:13: NOTICE: ProcedureCreate: type query_int is not yet defined
|
||||
psql:_int.sql:18: NOTICE: Argument type "query_int" is only a shell
|
||||
psql:_int.sql:367: NOTICE: ProcedureCreate: type intbig_gkey is not yet defined
|
||||
psql:_int.sql:372: NOTICE: Argument type "intbig_gkey" is only a shell
|
||||
psql:_int.sql:13: NOTICE: type query_int is not yet defined
|
||||
DETAIL: Creating a shell type definition.
|
||||
psql:_int.sql:18: NOTICE: argument type query_int is only a shell
|
||||
psql:_int.sql:367: NOTICE: type intbig_gkey is not yet defined
|
||||
DETAIL: Creating a shell type definition.
|
||||
psql:_int.sql:372: NOTICE: argument type intbig_gkey is only a shell
|
||||
SELECT intset(1234);
|
||||
intset
|
||||
--------
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- first, define the datatype. Turn off echoing so that expected file
|
||||
-- does not depend on contents of seg.sql.
|
||||
-- does not depend on contents of _int.sql.
|
||||
--
|
||||
\set ECHO none
|
||||
\i _int.sql
|
||||
|
Reference in New Issue
Block a user