Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 33d4c82

Browse files
committed
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.
1 parent 3610f08 commit 33d4c82

File tree

13 files changed

+48
-61
lines changed

13 files changed

+48
-61
lines changed

src/backend/commands/typecmds.c

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.43 2003/08/08 21:41:32 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.44 2003/09/09 23:22:19 petere Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -594,8 +594,8 @@ DefineDomain(CreateDomainStmt *stmt)
594594
/* Check for unsupported constraint types */
595595
if (IsA(newConstraint, FkConstraint))
596596
ereport(ERROR,
597-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
598-
errmsg("FOREIGN KEY constraints not supported for domains")));
597+
(errcode(ERRCODE_SYNTAX_ERROR),
598+
errmsg("foreign key constraints not possible for domains")));
599599

600600
/* otherwise it should be a plain Constraint */
601601
if (!IsA(newConstraint, Constraint))
@@ -672,14 +672,14 @@ DefineDomain(CreateDomainStmt *stmt)
672672
*/
673673
case CONSTR_UNIQUE:
674674
ereport(ERROR,
675-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
676-
errmsg("UNIQUE constraints not supported for domains")));
675+
(errcode(ERRCODE_SYNTAX_ERROR),
676+
errmsg("unique constraints not possible for domains")));
677677
break;
678678

679679
case CONSTR_PRIMARY:
680680
ereport(ERROR,
681-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
682-
errmsg("PRIMARY KEY constraints not supported for domains")));
681+
(errcode(ERRCODE_SYNTAX_ERROR),
682+
errmsg("primary key constraints not possible for domains")));
683683
break;
684684

685685
case CONSTR_ATTR_DEFERRABLE:
@@ -688,7 +688,7 @@ DefineDomain(CreateDomainStmt *stmt)
688688
case CONSTR_ATTR_IMMEDIATE:
689689
ereport(ERROR,
690690
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
691-
errmsg("deferrability constraints not supported for domains")));
691+
errmsg("specifying constraint deferrability not supported for domains")));
692692
break;
693693

694694
default:
@@ -1453,8 +1453,8 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
14531453
/* Check for unsupported constraint types */
14541454
if (IsA(newConstraint, FkConstraint))
14551455
ereport(ERROR,
1456-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1457-
errmsg("FOREIGN KEY constraints not supported for domains")));
1456+
(errcode(ERRCODE_SYNTAX_ERROR),
1457+
errmsg("foreign key constraints not possible for domains")));
14581458

14591459
/* otherwise it should be a plain Constraint */
14601460
if (!IsA(newConstraint, Constraint))
@@ -1465,33 +1465,20 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
14651465

14661466
switch (constr->contype)
14671467
{
1468-
case CONSTR_DEFAULT:
1469-
ereport(ERROR,
1470-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1471-
errmsg("use ALTER DOMAIN .. SET DEFAULT instead")));
1472-
break;
1473-
1474-
case CONSTR_NOTNULL:
1475-
case CONSTR_NULL:
1476-
ereport(ERROR,
1477-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1478-
errmsg("use ALTER DOMAIN .. [ SET | DROP ] NOT NULL instead")));
1479-
break;
1480-
14811468
case CONSTR_CHECK:
14821469
/* processed below */
14831470
break;
14841471

14851472
case CONSTR_UNIQUE:
14861473
ereport(ERROR,
1487-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1488-
errmsg("UNIQUE constraints not supported for domains")));
1474+
(errcode(ERRCODE_SYNTAX_ERROR),
1475+
errmsg("unique constraints not possible for domains")));
14891476
break;
14901477

14911478
case CONSTR_PRIMARY:
14921479
ereport(ERROR,
1493-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1494-
errmsg("PRIMARY KEY constraints not supported for domains")));
1480+
(errcode(ERRCODE_SYNTAX_ERROR),
1481+
errmsg("primary key constraints not possible for domains")));
14951482
break;
14961483

14971484
case CONSTR_ATTR_DEFERRABLE:
@@ -1500,7 +1487,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
15001487
case CONSTR_ATTR_IMMEDIATE:
15011488
ereport(ERROR,
15021489
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1503-
errmsg("deferrability constraints not supported for domains")));
1490+
errmsg("specifying constraint deferrability not supported for domains")));
15041491
break;
15051492

15061493
default:

src/backend/executor/execQual.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.142 2003/08/17 23:43:25 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.143 2003/09/09 23:22:20 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -713,7 +713,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
713713
*isDone = ExprEndResult;
714714
else
715715
ereport(ERROR,
716-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
716+
(errcode(ERRCODE_SYNTAX_ERROR),
717717
errmsg("set-valued function called in context that cannot accept a set")));
718718
return (Datum) 0;
719719
}
@@ -757,7 +757,7 @@ ExecMakeFunctionResult(FuncExprState *fcache,
757757
*/
758758
if (isDone == NULL)
759759
ereport(ERROR,
760-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
760+
(errcode(ERRCODE_SYNTAX_ERROR),
761761
errmsg("set-valued function called in context that cannot accept a set")));
762762

763763
/*
@@ -944,7 +944,7 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
944944
/* We don't allow sets in the arguments of the table function */
945945
if (argDone != ExprSingleResult)
946946
ereport(ERROR,
947-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
947+
(errcode(ERRCODE_SYNTAX_ERROR),
948948
errmsg("set-valued function called in context that cannot accept a set")));
949949

950950
/*
@@ -2955,7 +2955,7 @@ ExecTargetList(List *targetlist,
29552955
/* We have a set-valued expression in the tlist */
29562956
if (isDone == NULL)
29572957
ereport(ERROR,
2958-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2958+
(errcode(ERRCODE_SYNTAX_ERROR),
29592959
errmsg("set-valued function called in context that cannot accept a set")));
29602960
if (itemIsDone[resind] == ExprMultipleResult)
29612961
{

src/backend/executor/functions.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.71 2003/08/04 02:39:58 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.72 2003/09/09 23:22:20 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -574,7 +574,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
574574
rsi->isDone = ExprEndResult;
575575
else
576576
ereport(ERROR,
577-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
577+
(errcode(ERRCODE_SYNTAX_ERROR),
578578
errmsg("set-valued function called in context that cannot accept a set")));
579579
fcinfo->isnull = true;
580580
result = (Datum) 0;
@@ -613,7 +613,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
613613
rsi->isDone = ExprMultipleResult;
614614
else
615615
ereport(ERROR,
616-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
616+
(errcode(ERRCODE_SYNTAX_ERROR),
617617
errmsg("set-valued function called in context that cannot accept a set")));
618618

619619
/*

src/backend/parser/gram.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.431 2003/09/06 14:01:51 petere Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.432 2003/09/09 23:22:20 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -4610,7 +4610,7 @@ select_limit:
46104610
{
46114611
/* Disabled because it was too confusing, bjm 2002-02-18 */
46124612
ereport(ERROR,
4613-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4613+
(errcode(ERRCODE_SYNTAX_ERROR),
46144614
errmsg("LIMIT #,# syntax is not supported"),
46154615
errhint("Use separate LIMIT and OFFSET clauses.")));
46164616
}

src/backend/tcop/utility.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.205 2003/08/04 02:40:04 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.206 2003/09/09 23:22:21 petere Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -630,7 +630,7 @@ ProcessUtility(Node *parsetree,
630630
*/
631631
switch (stmt->subtype)
632632
{
633-
case 'T': /* ALTER COLUMN DEFAULT */
633+
case 'T': /* ALTER DOMAIN DEFAULT */
634634

635635
/*
636636
* Recursively alter column default for table and,
@@ -639,11 +639,11 @@ ProcessUtility(Node *parsetree,
639639
AlterDomainDefault(stmt->typename,
640640
stmt->def);
641641
break;
642-
case 'N': /* ALTER COLUMN DROP NOT NULL */
642+
case 'N': /* ALTER DOMAIN DROP NOT NULL */
643643
AlterDomainNotNull(stmt->typename,
644644
false);
645645
break;
646-
case 'O': /* ALTER COLUMN SET NOT NULL */
646+
case 'O': /* ALTER DOMAIN SET NOT NULL */
647647
AlterDomainNotNull(stmt->typename,
648648
true);
649649
break;

src/backend/utils/adt/acl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.96 2003/08/17 19:58:05 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.97 2003/09/09 23:22:21 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -846,7 +846,7 @@ makeaclitem(PG_FUNCTION_ARGS)
846846
else if (u_grantee != 0 && g_grantee != 0)
847847
{
848848
ereport(ERROR,
849-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
849+
(errcode(ERRCODE_SYNTAX_ERROR),
850850
errmsg("cannot specify both user and group")));
851851
}
852852
else if (u_grantee != 0)

src/backend/utils/adt/array_userfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.8 2003/08/17 23:43:26 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.9 2003/09/09 23:22:21 petere Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -95,8 +95,8 @@ array_push(PG_FUNCTION_ARGS)
9595
indx = 1;
9696
else
9797
ereport(ERROR,
98-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
99-
errmsg("input must be empty or one-dimensional array")));
98+
(errcode(ERRCODE_SYNTAX_ERROR),
99+
errmsg("argument must be empty or one-dimensional array")));
100100

101101
/*
102102
* We arrange to look up info about element type only once per series

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pg_stat_get_backend_idset(PG_FUNCTION_ARGS)
187187
if (fcinfo->resultinfo == NULL ||
188188
!IsA(fcinfo->resultinfo, ReturnSetInfo))
189189
ereport(ERROR,
190-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
190+
(errcode(ERRCODE_SYNTAX_ERROR),
191191
errmsg("set-valued function called in context that "
192192
"cannot accept a set")));
193193

src/backend/utils/adt/ri_triggers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1919
*
20-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.55 2003/08/17 19:58:05 tgl Exp $
20+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.56 2003/09/09 23:22:21 petere Exp $
2121
*
2222
* ----------
2323
*/
@@ -3009,7 +3009,7 @@ ri_ReportViolation(RI_QueryKey *qkey, const char *constrname,
30093009

30103010
if (spi_err)
30113011
ereport(ERROR,
3012-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3012+
(errcode(ERRCODE_INTERNAL_ERROR),
30133013
errmsg("referential integrity query on \"%s\" from constraint \"%s\" on \"%s\" gave unexpected result",
30143014
RelationGetRelationName(pk_rel),
30153015
constrname,

src/backend/utils/adt/ruleutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.152 2003/08/17 19:58:05 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.153 2003/09/09 23:22:21 petere Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -1098,8 +1098,8 @@ pg_get_constraintdef_worker(Oid constraintId, int prettyFlags)
10981098
}
10991099
default:
11001100
ereport(ERROR,
1101-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1102-
errmsg("unsupported constraint type \"%c\"",
1101+
(errcode(ERRCODE_INTERNAL_ERROR),
1102+
errmsg("invalid constraint type \"%c\"",
11031103
conForm->contype)));
11041104
break;
11051105
}

src/backend/utils/adt/sets.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.58 2003/08/04 02:40:05 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.59 2003/09/09 23:22:21 petere Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -203,7 +203,7 @@ seteval(PG_FUNCTION_ARGS)
203203
rsi->isDone = isDone;
204204
else
205205
ereport(ERROR,
206-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
206+
(errcode(ERRCODE_SYNTAX_ERROR),
207207
errmsg("set-valued function called in context that "
208208
"cannot accept a set")));
209209
}

src/backend/utils/adt/varbit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.34 2003/08/04 02:40:06 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.35 2003/09/09 23:22:21 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -901,7 +901,7 @@ bitand(PG_FUNCTION_ARGS)
901901
bitlen2 = VARBITLEN(arg2);
902902
if (bitlen1 != bitlen2)
903903
ereport(ERROR,
904-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
904+
(errcode(ERRCODE_SYNTAX_ERROR),
905905
errmsg("cannot AND bit strings of different sizes")));
906906

907907
len = VARSIZE(arg1);
@@ -942,7 +942,7 @@ bitor(PG_FUNCTION_ARGS)
942942
bitlen2 = VARBITLEN(arg2);
943943
if (bitlen1 != bitlen2)
944944
ereport(ERROR,
945-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
945+
(errcode(ERRCODE_SYNTAX_ERROR),
946946
errmsg("cannot OR bit strings of different sizes")));
947947
len = VARSIZE(arg1);
948948
result = (VarBit *) palloc(len);
@@ -988,7 +988,7 @@ bitxor(PG_FUNCTION_ARGS)
988988
bitlen2 = VARBITLEN(arg2);
989989
if (bitlen1 != bitlen2)
990990
ereport(ERROR,
991-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
991+
(errcode(ERRCODE_SYNTAX_ERROR),
992992
errmsg("cannot XOR bit strings of different sizes")));
993993

994994
len = VARSIZE(arg1);

src/backend/utils/fmgr/funcapi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2002-2003, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.9 2003/08/04 23:59:39 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.10 2003/09/09 23:22:21 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -34,7 +34,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
3434
*/
3535
if (fcinfo->resultinfo == NULL || !IsA(fcinfo->resultinfo, ReturnSetInfo))
3636
ereport(ERROR,
37-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
37+
(errcode(ERRCODE_SYNTAX_ERROR),
3838
errmsg("set-valued function called in context that cannot accept a set")));
3939

4040
if (fcinfo->flinfo->fn_extra == NULL)

0 commit comments

Comments
 (0)