Commit a56ff9a0 authored by Tom Lane's avatar Tom Lane

Another round of error message editing, covering backend/parser/.

parent 02303806
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.54 2003/07/01 19:10:52 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.55 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -69,7 +69,9 @@ transformAggregateCall(ParseState *pstate, Aggref *agg)
if (min_varlevel == 0)
{
if (checkExprHasAggs((Node *) agg->target))
elog(ERROR, "aggregate function calls may not be nested");
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregate function calls may not be nested")));
}
if (min_varlevel < 0)
......@@ -113,9 +115,13 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* problem is in WHERE.)
*/
if (checkExprHasAggs(qry->jointree->quals))
elog(ERROR, "Aggregates not allowed in WHERE clause");
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in WHERE clause")));
if (checkExprHasAggs((Node *) qry->jointree->fromlist))
elog(ERROR, "Aggregates not allowed in JOIN conditions");
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in JOIN conditions")));
/*
* No aggregates allowed in GROUP BY clauses, either.
......@@ -134,7 +140,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
if (expr == NULL)
continue; /* probably cannot happen */
if (checkExprHasAggs(expr))
elog(ERROR, "Aggregates not allowed in GROUP BY clause");
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in GROUP BY clause")));
groupClauses = lcons(expr, groupClauses);
if (!IsA(expr, Var))
have_non_var_grouping = true;
......@@ -291,11 +299,15 @@ check_ungrouped_columns_walker(Node *node,
rte = rt_fetch(var->varno, context->pstate->p_rtable);
attname = get_rte_attribute_name(rte, var->varattno);
if (context->sublevels_up == 0)
elog(ERROR, "Attribute %s.%s must be GROUPed or used in an aggregate function",
rte->eref->aliasname, attname);
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("attribute \"%s.%s\" must be GROUPed or used in an aggregate function",
rte->eref->aliasname, attname)));
else
elog(ERROR, "Sub-SELECT uses un-GROUPed attribute %s.%s from outer query",
rte->eref->aliasname, attname);
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("sub-select uses un-GROUPed attribute \"%s.%s\" from outer query",
rte->eref->aliasname, attname)));
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.154 2003/07/18 23:20:32 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.155 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -179,7 +179,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
case RTE_RELATION:
toid = get_rel_type_id(rte->relid);
if (!OidIsValid(toid))
elog(ERROR, "cannot find type OID for relation %u",
elog(ERROR, "could not find type OID for relation %u",
rte->relid);
/* replace RangeVar in the arg list */
lfirst(i) = makeVar(vnum,
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.78 2003/04/29 22:13:10 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.79 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -114,14 +114,15 @@ transformArraySubscripts(ParseState *pstate,
ObjectIdGetDatum(arrayType),
0, 0, 0);
if (!HeapTupleIsValid(type_tuple_array))
elog(ERROR, "transformArraySubscripts: Cache lookup failed for array type %u",
arrayType);
elog(ERROR, "cache lookup failed for type %u", arrayType);
type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple_array);
elementType = type_struct_array->typelem;
if (elementType == InvalidOid)
elog(ERROR, "transformArraySubscripts: type %s is not an array",
NameStr(type_struct_array->typname));
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot subscript type %s because it is not an array",
format_type_be(arrayType))));
/*
* A list containing only single subscripts refers to a single array
......@@ -177,7 +178,9 @@ transformArraySubscripts(ParseState *pstate,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
if (subexpr == NULL)
elog(ERROR, "array index expressions must be integers");
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("array subscript must have type integer")));
}
else
{
......@@ -198,7 +201,9 @@ transformArraySubscripts(ParseState *pstate,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
if (subexpr == NULL)
elog(ERROR, "array index expressions must be integers");
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("array subscript must have type integer")));
upperIndexpr = lappend(upperIndexpr, subexpr);
}
......@@ -218,11 +223,13 @@ transformArraySubscripts(ParseState *pstate,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
if (assignFrom == NULL)
elog(ERROR, "Array assignment requires type %s"
" but expression is of type %s"
"\n\tYou will need to rewrite or cast the expression",
format_type_be(typeneeded),
format_type_be(typesource));
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("array assignment requires type %s"
" but expression is of type %s",
format_type_be(typeneeded),
format_type_be(typesource)),
errhint("You will need to rewrite or cast the expression.")));
}
}
......@@ -323,18 +330,18 @@ make_const(Value *value)
typebyval = false;
break;
default:
elog(WARNING, "make_const: unknown type %d", nodeTag(value));
/* FALLTHROUGH */
case T_Null:
/* return a null const */
con = makeConst(UNKNOWNOID,
-1,
(Datum) NULL,
(Datum) 0,
true,
false);
return con;
default:
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(value));
return NULL; /* keep compiler quiet */
}
con = makeConst(typeid,
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.106 2003/07/03 16:34:20 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.107 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -61,7 +61,12 @@ transformTargetEntry(ParseState *pstate,
expr = transformExpr(pstate, node);
if (IsA(expr, RangeVar))
elog(ERROR, "You can't use relation names alone in the target list, try relation.*.");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("relation reference \"%s\" cannot be used as a targetlist entry",
((RangeVar *) expr)->relname),
errhint("Write \"%s\".* to denote all the columns of the relation.",
((RangeVar *) expr)->relname)));
type_id = exprType(expr);
type_mod = exprTypmod(expr);
......@@ -146,13 +151,18 @@ transformTargetList(ParseState *pstate, List *targetlist)
* it.
*/
if (strcmp(name1, get_database_name(MyDatabaseId)) != 0)
elog(ERROR, "Cross-database references are not implemented");
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cross-database references are not implemented")));
schemaname = strVal(lsecond(fields));
relname = strVal(lthird(fields));
break;
}
default:
elog(ERROR, "Invalid qualified name syntax (too many names)");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(fields))));
schemaname = NULL; /* keep compiler quiet */
relname = NULL;
break;
......@@ -269,7 +279,7 @@ markTargetListOrigin(ParseState *pstate, Resdom *res, Var *var)
}
/* falling off end of list shouldn't happen... */
if (subtl == NIL)
elog(ERROR, "Subquery %s does not have attribute %d",
elog(ERROR, "subquery %s does not have attribute %d",
rte->eref->aliasname, attnum);
}
break;
......@@ -320,7 +330,10 @@ updateTargetListEntry(ParseState *pstate,
Assert(rd != NULL);
if (attrno <= 0)
elog(ERROR, "Cannot assign to system attribute '%s'", colname);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot assign to system attribute \"%s\"",
colname)));
attrtype = attnumTypeId(rd, attrno);
attrtypmod = rd->rd_att->attrs[attrno - 1]->atttypmod;
......@@ -339,7 +352,9 @@ updateTargetListEntry(ParseState *pstate,
def->typeId = attrtype;
def->typeMod = attrtypmod;
if (indirection)
elog(ERROR, "cannot set an array element to DEFAULT");
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot set an array element to DEFAULT")));
}
/* Now we can use exprType() safely. */
......@@ -404,12 +419,14 @@ updateTargetListEntry(ParseState *pstate,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
if (tle->expr == NULL)
elog(ERROR, "column \"%s\" is of type %s"
" but expression is of type %s"
"\n\tYou will need to rewrite or cast the expression",
colname,
format_type_be(attrtype),
format_type_be(type_id));
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("column \"%s\" is of type %s"
" but expression is of type %s",
colname,
format_type_be(attrtype),
format_type_be(type_id)),
errhint("You will need to rewrite or cast the expression.")));
}
}
......@@ -473,11 +490,14 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
char *name = ((ResTarget *) lfirst(tl))->name;
int attrno;
/* Lookup column name, elog on failure */
/* Lookup column name, ereport on failure */
attrno = attnameAttNum(pstate->p_target_relation, name, false);
/* Check for duplicates */
if (intMember(attrno, *attrnos))
elog(ERROR, "Attribute '%s' specified more than once", name);
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("attribute \"%s\" specified more than once in INSERT list",
name)));
*attrnos = lappendi(*attrnos, attrno);
}
}
......@@ -512,8 +532,7 @@ ExpandAllTables(ParseState *pstate)
pstate->p_rtable);
else
{
elog(ERROR, "ExpandAllTables: unexpected node (internal error)"
"\n\t%s", nodeToString(n));
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(n));
rte = NULL; /* keep compiler quiet */
}
......@@ -530,7 +549,9 @@ ExpandAllTables(ParseState *pstate)
/* Check for SELECT *; */
if (!found_table)
elog(ERROR, "Wildcard with no tables specified not allowed");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("SELECT * with no tables specified is not valid")));
return target;
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.57 2003/04/29 22:13:10 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.58 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -57,8 +57,10 @@ LookupTypeName(const TypeName *typename)
switch (length(typename->names))
{
case 1:
elog(ERROR, "Improper %%TYPE reference (too few dotted names): %s",
NameListToString(typename->names));
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper %%TYPE reference (too few dotted names): %s",
NameListToString(typename->names))));
break;
case 2:
rel->relname = strVal(lfirst(typename->names));
......@@ -76,8 +78,10 @@ LookupTypeName(const TypeName *typename)
field = strVal(lfourth(typename->names));
break;
default:
elog(ERROR, "Improper %%TYPE reference (too many dotted names): %s",
NameListToString(typename->names));
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper %%TYPE reference (too many dotted names): %s",
NameListToString(typename->names))));
break;
}
......@@ -85,16 +89,20 @@ LookupTypeName(const TypeName *typename)
relid = RangeVarGetRelid(rel, false);
attnum = get_attnum(relid, field);
if (attnum == InvalidAttrNumber)
elog(ERROR, "Relation \"%s\" has no column \"%s\"",
rel->relname, field);
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("relation \"%s\" has no column \"%s\"",
rel->relname, field)));
restype = get_atttype(relid, attnum);
/* this construct should never have an array indicator */
Assert(typename->arrayBounds == NIL);
/* emit nuisance warning */
elog(NOTICE, "%s converted to %s",
TypeNameToString(typename), format_type_be(restype));
/* emit nuisance notice */
ereport(NOTICE,
(errmsg("type reference %s converted to %s",
TypeNameToString(typename),
format_type_be(restype))));
}
else
{
......@@ -188,11 +196,15 @@ typenameTypeId(const TypeName *typename)
typoid = LookupTypeName(typename);
if (!OidIsValid(typoid))
elog(ERROR, "Type \"%s\" does not exist",
TypeNameToString(typename));
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" does not exist",
TypeNameToString(typename))));
if (!get_typisdefined(typoid))
elog(ERROR, "Type \"%s\" is only a shell",
TypeNameToString(typename));
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" is only a shell",
TypeNameToString(typename))));
return typoid;
}
......@@ -210,17 +222,20 @@ typenameType(const TypeName *typename)
typoid = LookupTypeName(typename);
if (!OidIsValid(typoid))
elog(ERROR, "Type \"%s\" does not exist",
TypeNameToString(typename));
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" does not exist",
TypeNameToString(typename))));
tup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(typoid),
0, 0, 0);
if (!HeapTupleIsValid(tup))
elog(ERROR, "Type \"%s\" does not exist",
TypeNameToString(typename));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for type %u", typoid);
if (!((Form_pg_type) GETSTRUCT(tup))->typisdefined)
elog(ERROR, "Type \"%s\" is only a shell",
TypeNameToString(typename));
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" is only a shell",
TypeNameToString(typename))));
return (Type) tup;
}
......@@ -244,7 +259,7 @@ typeidType(Oid id)
ObjectIdGetDatum(id),
0, 0, 0);
if (!HeapTupleIsValid(tup))
elog(ERROR, "Unable to locate type oid %u in catalog", id);
elog(ERROR, "cache lookup failed for type %u", id);
return (Type) tup;
}
......@@ -252,7 +267,7 @@ typeidType(Oid id)
Oid
typeTypeId(Type tp)
{
if (tp == NULL)
if (tp == NULL) /* probably useless */
elog(ERROR, "typeTypeId() called with NULL type struct");
return HeapTupleGetOid(tp);
}
......@@ -386,7 +401,7 @@ typeidOutfunc(Oid type_id)
ObjectIdGetDatum(type_id),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "typeidOutfunc: Invalid type - oid = %u", type_id);
elog(ERROR, "cache lookup failed for type %u", type_id);
type = (Form_pg_type) GETSTRUCT(typeTuple);
outfunc = type->typoutput;
......@@ -407,7 +422,7 @@ typeidTypeRelid(Oid type_id)
ObjectIdGetDatum(type_id),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "typeidTypeRelid: Invalid type - oid = %u", type_id);
elog(ERROR, "cache lookup failed for type %u", type_id);
type = (Form_pg_type) GETSTRUCT(typeTuple);
result = type->typrelid;
......@@ -444,7 +459,7 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
* paranoia is justified since the string might contain anything.
*/
if (length(raw_parsetree_list) != 1)
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
stmt = (SelectStmt *) lfirst(raw_parsetree_list);
if (stmt == NULL ||
!IsA(stmt, SelectStmt) ||
......@@ -459,28 +474,35 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
stmt->limitCount != NULL ||
stmt->forUpdate != NIL ||
stmt->op != SETOP_NONE)
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
if (length(stmt->targetList) != 1)
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
restarget = (ResTarget *) lfirst(stmt->targetList);
if (restarget == NULL ||
!IsA(restarget, ResTarget) ||
restarget->name != NULL ||
restarget->indirection != NIL)
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
typecast = (TypeCast *) restarget->val;
if (typecast == NULL ||
!IsA(typecast, TypeCast) ||
typecast->arg == NULL ||
!IsA(typecast->arg, A_Const))
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
typename = typecast->typename;
if (typename == NULL ||
!IsA(typename, TypeName))
elog(ERROR, "Invalid type name '%s'", str);
goto fail;
*type_id = typenameTypeId(typename);
*typmod = typename->typmod;
pfree(buf.data);
return;
fail:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid type name \"%s\"", str)));
}
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.61 2003/07/18 23:20:32 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.62 2003/07/19 20:20:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -114,7 +114,7 @@ load_external_function(char *filename, char *funcname,
malloc(sizeof(DynamicFileList) + strlen(fullname));
if (file_scanner == NULL)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
MemSet((char *) file_scanner, 0, sizeof(DynamicFileList));
......
This diff is collapsed.
......@@ -156,4 +156,4 @@ select ten, sum(distinct four) from onek a
group by ten
having exists (select 1 from onek b
where sum(distinct a.four + b.four) = b.four);
ERROR: Aggregates not allowed in WHERE clause
ERROR: aggregates not allowed in WHERE clause
This diff is collapsed.
......@@ -358,7 +358,7 @@ select 33 * any (44);
ERROR: op ANY/ALL (array) requires array on right side
-- test indexes on arrays
create temp table arr_tbl (f1 int[] unique);
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'arr_tbl_f1_key' for table 'arr_tbl'
NOTICE: CREATE TABLE / UNIQUE will create implicit index "arr_tbl_f1_key" for table "arr_tbl"
insert into arr_tbl values ('{1,2,3}');
insert into arr_tbl values ('{1,2}');
-- failure expected:
......
......@@ -3,15 +3,15 @@
--
CREATE TABLE clstr_tst_s (rf_a SERIAL PRIMARY KEY,
b INT);
NOTICE: CREATE TABLE will create implicit sequence 'clstr_tst_s_rf_a_seq' for SERIAL column 'clstr_tst_s.rf_a'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_tst_s_pkey' for table 'clstr_tst_s'
NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_s_rf_a_seq" for SERIAL column "clstr_tst_s.rf_a"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_s_pkey" for table "clstr_tst_s"
CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY,
b INT,
c TEXT,
d TEXT,
CONSTRAINT clstr_tst_con FOREIGN KEY (b) REFERENCES clstr_tst_s);
NOTICE: CREATE TABLE will create implicit sequence 'clstr_tst_a_seq' for SERIAL column 'clstr_tst.a'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_tst_pkey' for table 'clstr_tst'
NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_a_seq" for SERIAL column "clstr_tst.a"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_pkey" for table "clstr_tst"
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE INDEX clstr_tst_b ON clstr_tst (b);
CREATE INDEX clstr_tst_c ON clstr_tst (c);
......@@ -300,11 +300,11 @@ WHERE pg_class.oid=indexrelid
-- Verify that clustering all tables does in fact cluster the right ones
CREATE USER clstr_user;
CREATE TABLE clstr_1 (a INT PRIMARY KEY);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_1_pkey' for table 'clstr_1'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_1_pkey" for table "clstr_1"
CREATE TABLE clstr_2 (a INT PRIMARY KEY);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_2_pkey' for table 'clstr_2'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_2_pkey" for table "clstr_2"
CREATE TABLE clstr_3 (a INT PRIMARY KEY);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_3_pkey' for table 'clstr_3'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_3_pkey" for table "clstr_3"
ALTER TABLE clstr_1 OWNER TO clstr_user;
ALTER TABLE clstr_3 OWNER TO clstr_user;
GRANT SELECT ON clstr_2 TO clstr_user;
......
......@@ -5,7 +5,7 @@ CREATE TABLE x (
d text not null,
e text
);
NOTICE: CREATE TABLE will create implicit sequence 'x_a_seq' for SERIAL column 'x.a'
NOTICE: CREATE TABLE will create implicit sequence "x_a_seq" for SERIAL column "x.a"
CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS '
BEGIN
NEW.e := ''before trigger fired''::text;
......@@ -28,7 +28,7 @@ COPY x (b, d) from stdin;
COPY x (a, b, c, d, e) from stdin;
-- non-existent column in column list: should fail
COPY x (xyz) from stdin;
ERROR: Relation "x" has no column "xyz"
ERROR: relation "x" has no column "xyz"
-- too many columns in column list: should fail
COPY x (a, b, c, d, e, d, c) from stdin;
ERROR: Attribute "d" specified more than once
......
......@@ -174,7 +174,7 @@ create table defaulttest
, col7 ddef4 DEFAULT 8000
, col8 ddef5
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'defaulttest_pkey' for table 'defaulttest'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "defaulttest_pkey" for table "defaulttest"
insert into defaulttest default values;
insert into defaulttest default values;
insert into defaulttest default values;
......
......@@ -31,19 +31,19 @@ select from pg_database;
ERROR: syntax error at or near "from" at character 8
-- bad name in target list
select nonesuch from pg_database;
ERROR: Attribute "nonesuch" not found
ERROR: attribute "nonesuch" not found
-- bad attribute name on lhs of operator
select * from pg_database where nonesuch = pg_database.datname;
ERROR: Attribute "nonesuch" not found
ERROR: attribute "nonesuch" not found
-- bad attribute name on rhs of operator
select * from pg_database where pg_database.datname = nonesuch;
ERROR: Attribute "nonesuch" not found
ERROR: attribute "nonesuch" not found
-- bad select distinct on syntax, distinct attribute missing
select distinct on (foobar) from pg_database;
ERROR: syntax error at or near "from" at character 29
-- bad select distinct on syntax, distinct attribute not in target list
select distinct on (foobar) * from pg_database;
ERROR: Attribute "foobar" not found
ERROR: attribute "foobar" not found
--
-- DELETE
......@@ -143,7 +143,7 @@ drop aggregate 314159 (int);
ERROR: syntax error at or near "314159" at character 16
-- bad aggregate type
drop aggregate newcnt (nonesuch);
ERROR: Type "nonesuch" does not exist
ERROR: type "nonesuch" does not exist
-- no such aggregate
drop aggregate nonesuch (int4);
ERROR: aggregate nonesuch(integer) does not exist
......@@ -197,13 +197,13 @@ drop operator === ();
ERROR: syntax error at or near ")" at character 20
-- no such operator
drop operator === (int4);
ERROR: parser: argument type missing (use NONE for unary operators)
ERROR: argument type missing (use NONE for unary operators)
-- no such operator by that name
drop operator === (int4, int4);
ERROR: operator does not exist: integer === integer
-- no such type1
drop operator = (nonesuch);
ERROR: parser: argument type missing (use NONE for unary operators)
ERROR: argument type missing (use NONE for unary operators)
-- no such type1
drop operator = ( , int4);
ERROR: syntax error at or near "," at character 19
......
This diff is collapsed.
......@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
(1 row)
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
ERROR: Cannot cast type time with time zone to interval
ERROR: cannot cast type time with time zone to interval
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
ERROR: Cannot cast type interval to time with time zone
ERROR: cannot cast type interval to time with time zone
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
23:29:00-08
-------------
......
......@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
(1 row)
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
ERROR: Cannot cast type time with time zone to interval
ERROR: cannot cast type time with time zone to interval
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
ERROR: Cannot cast type interval to time with time zone
ERROR: cannot cast type interval to time with time zone
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
23:29:00-08
-------------
......
......@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
(1 row)
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
ERROR: Cannot cast type time with time zone to interval
ERROR: cannot cast type time with time zone to interval
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
ERROR: Cannot cast type interval to time with time zone
ERROR: cannot cast type interval to time with time zone
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
23:29:00-08
-------------
......
......@@ -536,7 +536,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
-- Confirm PRIMARY KEY adds NOT NULL constraint to child table
CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'z_pkey' for table 'z'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "z_pkey" for table "z"
INSERT INTO z VALUES (NULL, 'text'); -- should fail
ERROR: ExecInsert: Fail to add null value in not null attribute aa
-- Check UPDATE with inherited target and an inherited source table
......
......@@ -336,7 +336,7 @@ SELECT '' AS "xxx", *
-- ambiguous column
SELECT '' AS "xxx", i, k, t
FROM J1_TBL CROSS JOIN J2_TBL;
ERROR: Column reference "i" is ambiguous
ERROR: column reference "i" is ambiguous
-- resolve previous ambiguity by specifying the table name
SELECT '' AS "xxx", t1.i, k, t
FROM J1_TBL t1 CROSS JOIN J2_TBL t2;
......
......@@ -69,17 +69,19 @@ EXECUTE q3('AAAAxx', 5::smallint, 10.5::float, false, 500::oid, 4::bigint);
-- too few params
EXECUTE q3('bool');
ERROR: Wrong number of parameters, expected 6 but got 1
ERROR: wrong number of parameters for prepared statement "q3"
DETAIL: Expected 6 parameters but got 1.
-- too many params
EXECUTE q3('bytea', 5::smallint, 10.5::float, false, 500::oid, 4::bigint, true);
ERROR: Wrong number of parameters, expected 6 but got 7
ERROR: wrong number of parameters for prepared statement "q3"
DETAIL: Expected 6 parameters but got 7.
-- wrong param types
EXECUTE q3(5::smallint, 10.5::float, false, 500::oid, 4::bigint, 'bytea');
ERROR: Parameter $3 of type boolean cannot be coerced into the expected type double precision
You will need to rewrite or cast the expression
ERROR: parameter $3 of type boolean cannot be coerced to the expected type double precision
HINT: You will need to rewrite or cast the expression.
-- invalid type
PREPARE q4(nonexistenttype) AS SELECT $1;
ERROR: Type "nonexistenttype" does not exist
ERROR: type "nonexistenttype" does not exist
-- create table as execute
PREPARE q5(int, text) AS
SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2;
......
......@@ -18,7 +18,7 @@ INSERT INTO foo2 VALUES(1, 111);
CREATE FUNCTION foot(int) returns setof foo2 as 'SELECT * FROM foo2 WHERE fooid = $1;' LANGUAGE SQL;
-- supposed to fail with ERROR
select * from foo2, foot(foo2.fooid) z where foo2.f2 = z.f2;
ERROR: FROM function expression may not refer to other relations of same query level
ERROR: function expression in FROM may not refer to other relations of same query level
-- function in subselect
select * from foo2 where f2 in (select f2 from foot(foo2.fooid) z where z.fooid = foo2.fooid) ORDER BY 1,2;
fooid | f2
......@@ -53,7 +53,7 @@ select foot.fooid, foot.f2 from foot(sin(pi()/2)::int) ORDER BY 1,2;
(2 rows)
CREATE TABLE foo (fooid int, foosubid int, fooname text, primary key(fooid,foosubid));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
INSERT INTO foo VALUES(1,1,'Joe');
INSERT INTO foo VALUES(1,2,'Ed');
INSERT INTO foo VALUES(2,1,'Mary');
......@@ -225,7 +225,7 @@ DROP TABLE foo2;
DROP TABLE foo;
-- Rescan tests --
CREATE TABLE foorescan (fooid int, foosubid int, fooname text, primary key(fooid,foosubid));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'foorescan_pkey' for table 'foorescan'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foorescan_pkey" for table "foorescan"
INSERT INTO foorescan values(5000,1,'abc.5000.1');
INSERT INTO foorescan values(5001,1,'abc.5001.1');
INSERT INTO foorescan values(5002,1,'abc.5002.1');
......@@ -311,7 +311,7 @@ SELECT * FROM foorescan f WHERE f.fooid IN (SELECT fooid FROM vw_foorescan) ORDE
(10 rows)
CREATE TABLE barrescan (fooid int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'barrescan_pkey' for table 'barrescan'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "barrescan_pkey" for table "barrescan"
INSERT INTO barrescan values(5003);
INSERT INTO barrescan values(5004);
INSERT INTO barrescan values(5005);
......
......@@ -1180,7 +1180,7 @@ drop rule foorule on foo;
-- this should fail because f1 is not exposed for unqualified reference:
create rule foorule as on insert to foo where f1 < 100
do instead insert into foo2 values (f1);
ERROR: Attribute "f1" not found
ERROR: attribute "f1" not found
-- this is the correct way:
create rule foorule as on insert to foo where f1 < 100
do instead insert into foo2 values (new.f1);
......
......@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
count
......@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
SELECT count(*) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b ORDER BY b;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- order w/ target under ambiguous condition
-- failure NOT expected
SELECT a, a FROM test_missing_target
......@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
count
......@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b/2 ORDER BY b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/ existing GROUP BY target under ambiguous condition
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
......@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
SELECT count(b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY x.b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/o existing GROUP BY target under ambiguous condition
-- into a table
SELECT count(x.b) INTO TABLE test_missing_target3
......
......@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
count
......@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
SELECT count(*) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b ORDER BY b;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- order w/ target under ambiguous condition
-- failure NOT expected
SELECT a, a FROM test_missing_target
......@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
count
......@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b/2 ORDER BY b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/ existing GROUP BY target under ambiguous condition
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
......@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
SELECT count(b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY x.b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/o existing GROUP BY target under ambiguous condition
-- into a table
SELECT count(x.b) INTO TABLE test_missing_target3
......
......@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
count
......@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
SELECT count(*) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b ORDER BY b;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- order w/ target under ambiguous condition
-- failure NOT expected
SELECT a, a FROM test_missing_target
......@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
-- failure expected
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
count
......@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY b/2 ORDER BY b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/ existing GROUP BY target under ambiguous condition
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
......@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
SELECT count(b) FROM test_missing_target x, test_missing_target y
WHERE x.a = y.a
GROUP BY x.b/2;
ERROR: Column reference "b" is ambiguous
ERROR: column reference "b" is ambiguous
-- group w/o existing GROUP BY target under ambiguous condition
-- into a table
SELECT count(x.b) INTO TABLE test_missing_target3
......
......@@ -3,7 +3,7 @@
---
CREATE TABLE serialTest (f1 text, f2 serial);
NOTICE: CREATE TABLE will create implicit sequence 'serialtest_f2_seq' for SERIAL column 'serialtest.f2'
NOTICE: CREATE TABLE will create implicit sequence "serialtest_f2_seq" for SERIAL column "serialtest.f2"
INSERT INTO serialTest VALUES ('foo');
INSERT INTO serialTest VALUES ('bar');
......
-- Test basic TRUNCATE functionality.
CREATE TABLE truncate_a (col1 integer primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'truncate_a_pkey' for table 'truncate_a'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "truncate_a_pkey" for table "truncate_a"
INSERT INTO truncate_a VALUES (1);
INSERT INTO truncate_a VALUES (2);
SELECT * FROM truncate_a;
......
......@@ -404,7 +404,7 @@ ORDER BY q2,q1;
-- This should fail, because q2 isn't a name of an EXCEPT output column
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1;
ERROR: Attribute "q2" not found
ERROR: attribute "q2" not found
-- But this should work:
SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1)));
q1
......
......@@ -286,7 +286,7 @@ SELECT * FROM COPY_TBL;
-- Primary keys
--
CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl"
INSERT INTO PRIMARY_TBL VALUES (1, 'one');
INSERT INTO PRIMARY_TBL VALUES (2, 'two');
INSERT INTO PRIMARY_TBL VALUES (1, 'three');
......@@ -307,7 +307,7 @@ SELECT '' AS four, * FROM PRIMARY_TBL;
DROP TABLE PRIMARY_TBL;
CREATE TABLE PRIMARY_TBL (i int, t text,
PRIMARY KEY(i,t));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl"
INSERT INTO PRIMARY_TBL VALUES (1, 'one');
INSERT INTO PRIMARY_TBL VALUES (2, 'two');
INSERT INTO PRIMARY_TBL VALUES (1, 'three');
......@@ -330,7 +330,7 @@ DROP TABLE PRIMARY_TBL;
-- Unique keys
--
CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text);
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl'
NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl"
INSERT INTO UNIQUE_TBL VALUES (1, 'one');
INSERT INTO UNIQUE_TBL VALUES (2, 'two');
INSERT INTO UNIQUE_TBL VALUES (1, 'three');
......@@ -353,7 +353,7 @@ SELECT '' AS five, * FROM UNIQUE_TBL;
DROP TABLE UNIQUE_TBL;
CREATE TABLE UNIQUE_TBL (i int, t text,
UNIQUE(i,t));
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl'
NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl"
INSERT INTO UNIQUE_TBL VALUES (1, 'one');
INSERT INTO UNIQUE_TBL VALUES (2, 'two');
INSERT INTO UNIQUE_TBL VALUES (1, 'three');
......
......@@ -13,8 +13,8 @@ CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
RETURNS hobbies_r.person%TYPE
AS 'select person from hobbies_r where name = $1'
LANGUAGE 'sql';
NOTICE: hobbies_r.person%TYPE converted to text
NOTICE: hobbies_r.name%TYPE converted to text
NOTICE: type reference hobbies_r.person%TYPE converted to text
NOTICE: type reference hobbies_r.name%TYPE converted to text
CREATE FUNCTION equipment(hobbies_r)
RETURNS setof equipment_r
AS 'select * from equipment_r where hobby = $1.name'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment