1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Some "feature not supported" errors are better syntax errors, because the

feature they complain about isn't a feature or cannot be implemented without
definitional changes.
This commit is contained in:
Peter Eisentraut
2003-09-09 23:22:21 +00:00
parent 3610f083c1
commit 33d4c828fd
13 changed files with 48 additions and 61 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.43 2003/08/08 21:41:32 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.44 2003/09/09 23:22:19 petere Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
@ -594,8 +594,8 @@ DefineDomain(CreateDomainStmt *stmt)
/* Check for unsupported constraint types */ /* Check for unsupported constraint types */
if (IsA(newConstraint, FkConstraint)) if (IsA(newConstraint, FkConstraint))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("FOREIGN KEY constraints not supported for domains"))); errmsg("foreign key constraints not possible for domains")));
/* otherwise it should be a plain Constraint */ /* otherwise it should be a plain Constraint */
if (!IsA(newConstraint, Constraint)) if (!IsA(newConstraint, Constraint))
@ -672,14 +672,14 @@ DefineDomain(CreateDomainStmt *stmt)
*/ */
case CONSTR_UNIQUE: case CONSTR_UNIQUE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("UNIQUE constraints not supported for domains"))); errmsg("unique constraints not possible for domains")));
break; break;
case CONSTR_PRIMARY: case CONSTR_PRIMARY:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PRIMARY KEY constraints not supported for domains"))); errmsg("primary key constraints not possible for domains")));
break; break;
case CONSTR_ATTR_DEFERRABLE: case CONSTR_ATTR_DEFERRABLE:
@ -688,7 +688,7 @@ DefineDomain(CreateDomainStmt *stmt)
case CONSTR_ATTR_IMMEDIATE: case CONSTR_ATTR_IMMEDIATE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("deferrability constraints not supported for domains"))); errmsg("specifying constraint deferrability not supported for domains")));
break; break;
default: default:
@ -1453,8 +1453,8 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
/* Check for unsupported constraint types */ /* Check for unsupported constraint types */
if (IsA(newConstraint, FkConstraint)) if (IsA(newConstraint, FkConstraint))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("FOREIGN KEY constraints not supported for domains"))); errmsg("foreign key constraints not possible for domains")));
/* otherwise it should be a plain Constraint */ /* otherwise it should be a plain Constraint */
if (!IsA(newConstraint, Constraint)) if (!IsA(newConstraint, Constraint))
@ -1465,33 +1465,20 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
switch (constr->contype) switch (constr->contype)
{ {
case CONSTR_DEFAULT:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("use ALTER DOMAIN .. SET DEFAULT instead")));
break;
case CONSTR_NOTNULL:
case CONSTR_NULL:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("use ALTER DOMAIN .. [ SET | DROP ] NOT NULL instead")));
break;
case CONSTR_CHECK: case CONSTR_CHECK:
/* processed below */ /* processed below */
break; break;
case CONSTR_UNIQUE: case CONSTR_UNIQUE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("UNIQUE constraints not supported for domains"))); errmsg("unique constraints not possible for domains")));
break; break;
case CONSTR_PRIMARY: case CONSTR_PRIMARY:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PRIMARY KEY constraints not supported for domains"))); errmsg("primary key constraints not possible for domains")));
break; break;
case CONSTR_ATTR_DEFERRABLE: case CONSTR_ATTR_DEFERRABLE:
@ -1500,7 +1487,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
case CONSTR_ATTR_IMMEDIATE: case CONSTR_ATTR_IMMEDIATE:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("deferrability constraints not supported for domains"))); errmsg("specifying constraint deferrability not supported for domains")));
break; break;
default: default:

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.142 2003/08/17 23:43:25 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.143 2003/09/09 23:22:20 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -713,7 +713,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
*isDone = ExprEndResult; *isDone = ExprEndResult;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
return (Datum) 0; return (Datum) 0;
} }
@ -757,7 +757,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
*/ */
if (isDone == NULL) if (isDone == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
/* /*
@ -944,7 +944,7 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
/* We don't allow sets in the arguments of the table function */ /* We don't allow sets in the arguments of the table function */
if (argDone != ExprSingleResult) if (argDone != ExprSingleResult)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
/* /*
@ -2955,7 +2955,7 @@ ExecTargetList(List *targetlist,
/* We have a set-valued expression in the tlist */ /* We have a set-valued expression in the tlist */
if (isDone == NULL) if (isDone == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
if (itemIsDone[resind] == ExprMultipleResult) if (itemIsDone[resind] == ExprMultipleResult)
{ {

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.71 2003/08/04 02:39:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.72 2003/09/09 23:22:20 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -574,7 +574,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
rsi->isDone = ExprEndResult; rsi->isDone = ExprEndResult;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
fcinfo->isnull = true; fcinfo->isnull = true;
result = (Datum) 0; result = (Datum) 0;
@ -613,7 +613,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
rsi->isDone = ExprMultipleResult; rsi->isDone = ExprMultipleResult;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
/* /*

View File

@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.431 2003/09/06 14:01:51 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.432 2003/09/09 23:22:20 petere Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
@ -4610,7 +4610,7 @@ select_limit:
{ {
/* Disabled because it was too confusing, bjm 2002-02-18 */ /* Disabled because it was too confusing, bjm 2002-02-18 */
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("LIMIT #,# syntax is not supported"), errmsg("LIMIT #,# syntax is not supported"),
errhint("Use separate LIMIT and OFFSET clauses."))); errhint("Use separate LIMIT and OFFSET clauses.")));
} }

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.205 2003/08/04 02:40:04 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.206 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -630,7 +630,7 @@ ProcessUtility(Node *parsetree,
*/ */
switch (stmt->subtype) switch (stmt->subtype)
{ {
case 'T': /* ALTER COLUMN DEFAULT */ case 'T': /* ALTER DOMAIN DEFAULT */
/* /*
* Recursively alter column default for table and, * Recursively alter column default for table and,
@ -639,11 +639,11 @@ ProcessUtility(Node *parsetree,
AlterDomainDefault(stmt->typename, AlterDomainDefault(stmt->typename,
stmt->def); stmt->def);
break; break;
case 'N': /* ALTER COLUMN DROP NOT NULL */ case 'N': /* ALTER DOMAIN DROP NOT NULL */
AlterDomainNotNull(stmt->typename, AlterDomainNotNull(stmt->typename,
false); false);
break; break;
case 'O': /* ALTER COLUMN SET NOT NULL */ case 'O': /* ALTER DOMAIN SET NOT NULL */
AlterDomainNotNull(stmt->typename, AlterDomainNotNull(stmt->typename,
true); true);
break; break;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.96 2003/08/17 19:58:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.97 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -846,7 +846,7 @@ makeaclitem(PG_FUNCTION_ARGS)
else if (u_grantee != 0 && g_grantee != 0) else if (u_grantee != 0 && g_grantee != 0)
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot specify both user and group"))); errmsg("cannot specify both user and group")));
} }
else if (u_grantee != 0) else if (u_grantee != 0)

View File

@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group * Copyright (c) 2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.8 2003/08/17 23:43:26 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.9 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -95,8 +95,8 @@ array_push(PG_FUNCTION_ARGS)
indx = 1; indx = 1;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("input must be empty or one-dimensional array"))); errmsg("argument must be empty or one-dimensional array")));
/* /*
* We arrange to look up info about element type only once per series * We arrange to look up info about element type only once per series

View File

@ -187,7 +187,7 @@ pg_stat_get_backend_idset(PG_FUNCTION_ARGS)
if (fcinfo->resultinfo == NULL || if (fcinfo->resultinfo == NULL ||
!IsA(fcinfo->resultinfo, ReturnSetInfo)) !IsA(fcinfo->resultinfo, ReturnSetInfo))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that " errmsg("set-valued function called in context that "
"cannot accept a set"))); "cannot accept a set")));

View File

@ -17,7 +17,7 @@
* *
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.55 2003/08/17 19:58:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.56 2003/09/09 23:22:21 petere Exp $
* *
* ---------- * ----------
*/ */
@ -3009,7 +3009,7 @@ ri_ReportViolation(RI_QueryKey *qkey, const char *constrname,
if (spi_err) if (spi_err)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("referential integrity query on \"%s\" from constraint \"%s\" on \"%s\" gave unexpected result", errmsg("referential integrity query on \"%s\" from constraint \"%s\" on \"%s\" gave unexpected result",
RelationGetRelationName(pk_rel), RelationGetRelationName(pk_rel),
constrname, constrname,

View File

@ -3,7 +3,7 @@
* back to source text * back to source text
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.152 2003/08/17 19:58:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.153 2003/09/09 23:22:21 petere Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
@ -1098,8 +1098,8 @@ pg_get_constraintdef_worker(Oid constraintId, int prettyFlags)
} }
default: default:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("unsupported constraint type \"%c\"", errmsg("invalid constraint type \"%c\"",
conForm->contype))); conForm->contype)));
break; break;
} }

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.58 2003/08/04 02:40:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.59 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -203,7 +203,7 @@ seteval(PG_FUNCTION_ARGS)
rsi->isDone = isDone; rsi->isDone = isDone;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that " errmsg("set-valued function called in context that "
"cannot accept a set"))); "cannot accept a set")));
} }

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.34 2003/08/04 02:40:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.35 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -901,7 +901,7 @@ bitand(PG_FUNCTION_ARGS)
bitlen2 = VARBITLEN(arg2); bitlen2 = VARBITLEN(arg2);
if (bitlen1 != bitlen2) if (bitlen1 != bitlen2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot AND bit strings of different sizes"))); errmsg("cannot AND bit strings of different sizes")));
len = VARSIZE(arg1); len = VARSIZE(arg1);
@ -942,7 +942,7 @@ bitor(PG_FUNCTION_ARGS)
bitlen2 = VARBITLEN(arg2); bitlen2 = VARBITLEN(arg2);
if (bitlen1 != bitlen2) if (bitlen1 != bitlen2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot OR bit strings of different sizes"))); errmsg("cannot OR bit strings of different sizes")));
len = VARSIZE(arg1); len = VARSIZE(arg1);
result = (VarBit *) palloc(len); result = (VarBit *) palloc(len);
@ -988,7 +988,7 @@ bitxor(PG_FUNCTION_ARGS)
bitlen2 = VARBITLEN(arg2); bitlen2 = VARBITLEN(arg2);
if (bitlen1 != bitlen2) if (bitlen1 != bitlen2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot XOR bit strings of different sizes"))); errmsg("cannot XOR bit strings of different sizes")));
len = VARSIZE(arg1); len = VARSIZE(arg1);

View File

@ -7,7 +7,7 @@
* Copyright (c) 2002-2003, PostgreSQL Global Development Group * Copyright (c) 2002-2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.9 2003/08/04 23:59:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.10 2003/09/09 23:22:21 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -34,7 +34,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
*/ */
if (fcinfo->resultinfo == NULL || !IsA(fcinfo->resultinfo, ReturnSetInfo)) if (fcinfo->resultinfo == NULL || !IsA(fcinfo->resultinfo, ReturnSetInfo))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("set-valued function called in context that cannot accept a set"))); errmsg("set-valued function called in context that cannot accept a set")));
if (fcinfo->flinfo->fn_extra == NULL) if (fcinfo->flinfo->fn_extra == NULL)