Commit 79fafdf4 authored by Tom Lane's avatar Tom Lane

Some early work on error message editing. Operator-not-found and

function-not-found messages now distinguish the cases no-match and
ambiguous-match, and they follow the style guidelines too.
parent cdb8a844
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.82 2003/06/27 14:45:26 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.83 2003/07/04 02:51:33 tgl Exp $
* *
* NOTES * NOTES
* See acl.h. * See acl.h.
...@@ -397,8 +397,7 @@ ExecuteGrantStmt_Function(GrantStmt *stmt) ...@@ -397,8 +397,7 @@ ExecuteGrantStmt_Function(GrantStmt *stmt)
char nulls[Natts_pg_proc]; char nulls[Natts_pg_proc];
char replaces[Natts_pg_proc]; char replaces[Natts_pg_proc];
oid = LookupFuncNameTypeNames(func->funcname, func->funcargs, oid = LookupFuncNameTypeNames(func->funcname, func->funcargs, false);
stmt->is_grant ? "GRANT" : "REVOKE");
relation = heap_openr(ProcedureRelationName, RowExclusiveLock); relation = heap_openr(ProcedureRelationName, RowExclusiveLock);
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache(PROCOID,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.59 2003/07/01 19:10:52 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.60 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -109,8 +109,7 @@ AggregateCreate(const char *aggName, ...@@ -109,8 +109,7 @@ AggregateCreate(const char *aggName,
ObjectIdGetDatum(transfn), ObjectIdGetDatum(transfn),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
func_error("AggregateCreate", aggtransfnName, elog(ERROR, "cache lookup of function %u failed", transfn);
nargs_transfn, fnArgs, NULL);
proc = (Form_pg_proc) GETSTRUCT(tup); proc = (Form_pg_proc) GETSTRUCT(tup);
/* /*
...@@ -264,10 +263,12 @@ lookup_agg_function(List *fnName, ...@@ -264,10 +263,12 @@ lookup_agg_function(List *fnName,
&true_oid_array); &true_oid_array);
/* only valid case is a normal function not returning a set */ /* only valid case is a normal function not returning a set */
if (fdresult != FUNCDETAIL_NORMAL || if (fdresult != FUNCDETAIL_NORMAL || !OidIsValid(fnOid))
!OidIsValid(fnOid) || elog(ERROR, "function %s does not exist",
retset) func_signature_string(fnName, nargs, input_types));
func_error("AggregateCreate", fnName, nargs, input_types, NULL); if (retset)
elog(ERROR, "function %s returns a set",
func_signature_string(fnName, nargs, input_types));
/* /*
* If the given type(s) are all polymorphic, there's nothing we * If the given type(s) are all polymorphic, there's nothing we
...@@ -295,13 +296,15 @@ lookup_agg_function(List *fnName, ...@@ -295,13 +296,15 @@ lookup_agg_function(List *fnName,
if (true_oid_array[0] != ANYARRAYOID && if (true_oid_array[0] != ANYARRAYOID &&
true_oid_array[0] != ANYELEMENTOID && true_oid_array[0] != ANYELEMENTOID &&
!IsBinaryCoercible(input_types[0], true_oid_array[0])) !IsBinaryCoercible(input_types[0], true_oid_array[0]))
func_error("AggregateCreate", fnName, nargs, input_types, NULL); elog(ERROR, "function %s requires run-time type coercion",
func_signature_string(fnName, nargs, true_oid_array));
if (nargs == 2 && if (nargs == 2 &&
true_oid_array[1] != ANYARRAYOID && true_oid_array[1] != ANYARRAYOID &&
true_oid_array[1] != ANYELEMENTOID && true_oid_array[1] != ANYELEMENTOID &&
!IsBinaryCoercible(input_types[1], true_oid_array[1])) !IsBinaryCoercible(input_types[1], true_oid_array[1]))
func_error("AggregateCreate", fnName, nargs, input_types, NULL); elog(ERROR, "function %s requires run-time type coercion",
func_signature_string(fnName, nargs, true_oid_array));
return fnOid; return fnOid;
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.78 2003/01/28 22:13:25 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.79 2003/07/04 02:51:33 tgl Exp $
* *
* NOTES * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
...@@ -175,7 +175,7 @@ OperatorLookup(List *operatorName, ...@@ -175,7 +175,7 @@ OperatorLookup(List *operatorName,
RegProcedure oprcode; RegProcedure oprcode;
operatorObjectId = LookupOperName(operatorName, leftObjectId, operatorObjectId = LookupOperName(operatorName, leftObjectId,
rightObjectId); rightObjectId, true);
if (!OidIsValid(operatorObjectId)) if (!OidIsValid(operatorObjectId))
{ {
*defined = false; *defined = false;
...@@ -453,9 +453,7 @@ OperatorCreate(const char *operatorName, ...@@ -453,9 +453,7 @@ OperatorCreate(const char *operatorName,
typeId[1] = rightTypeId; typeId[1] = rightTypeId;
nargs = 2; nargs = 2;
} }
procOid = LookupFuncName(procedureName, nargs, typeId); procOid = LookupFuncName(procedureName, nargs, typeId, false);
if (!OidIsValid(procOid))
func_error("OperatorDef", procedureName, nargs, typeId, NULL);
operResultType = get_func_rettype(procOid); operResultType = get_func_rettype(procOid);
/* /*
...@@ -469,9 +467,7 @@ OperatorCreate(const char *operatorName, ...@@ -469,9 +467,7 @@ OperatorCreate(const char *operatorName,
typeId[2] = INTERNALOID; /* args list */ typeId[2] = INTERNALOID; /* args list */
typeId[3] = INT4OID; /* varRelid */ typeId[3] = INT4OID; /* varRelid */
restOid = LookupFuncName(restrictionName, 4, typeId); restOid = LookupFuncName(restrictionName, 4, typeId, false);
if (!OidIsValid(restOid))
func_error("OperatorDef", restrictionName, 4, typeId, NULL);
} }
else else
restOid = InvalidOid; restOid = InvalidOid;
...@@ -487,9 +483,7 @@ OperatorCreate(const char *operatorName, ...@@ -487,9 +483,7 @@ OperatorCreate(const char *operatorName,
typeId[2] = INTERNALOID; /* args list */ typeId[2] = INTERNALOID; /* args list */
typeId[3] = INT2OID; /* jointype */ typeId[3] = INT2OID; /* jointype */
joinOid = LookupFuncName(joinName, 4, typeId); joinOid = LookupFuncName(joinName, 4, typeId, false);
if (!OidIsValid(joinOid))
func_error("OperatorDef", joinName, 4, typeId, NULL);
} }
else else
joinOid = InvalidOid; joinOid = InvalidOid;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.9 2003/07/01 19:10:52 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.10 2003/07/04 02:51:33 tgl 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
...@@ -165,7 +165,7 @@ RemoveAggregate(RemoveAggrStmt *stmt) ...@@ -165,7 +165,7 @@ RemoveAggregate(RemoveAggrStmt *stmt)
else else
basetypeID = ANYOID; basetypeID = ANYOID;
procOid = find_aggregate_func("RemoveAggregate", aggName, basetypeID); procOid = find_aggregate_func(aggName, basetypeID, false);
/* /*
* Find the function tuple, do permissions and validity checks * Find the function tuple, do permissions and validity checks
...@@ -223,7 +223,7 @@ RenameAggregate(List *name, TypeName *basetype, const char *newname) ...@@ -223,7 +223,7 @@ RenameAggregate(List *name, TypeName *basetype, const char *newname)
rel = heap_openr(ProcedureRelationName, RowExclusiveLock); rel = heap_openr(ProcedureRelationName, RowExclusiveLock);
procOid = find_aggregate_func("RenameAggregate", name, basetypeOid); procOid = find_aggregate_func(name, basetypeOid, false);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy(PROCOID,
ObjectIdGetDatum(procOid), ObjectIdGetDatum(procOid),
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (c) 1996-2001, PostgreSQL Global Development Group * Copyright (c) 1996-2001, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.63 2003/06/27 14:45:27 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.64 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -629,7 +629,7 @@ CommentAggregate(List *aggregate, List *arguments, char *comment) ...@@ -629,7 +629,7 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
/* Now, attempt to find the actual tuple in pg_proc */ /* Now, attempt to find the actual tuple in pg_proc */
oid = find_aggregate_func("CommentAggregate", aggregate, baseoid); oid = find_aggregate_func(aggregate, baseoid, false);
/* Next, validate the user's attempt to comment */ /* Next, validate the user's attempt to comment */
...@@ -657,8 +657,7 @@ CommentProc(List *function, List *arguments, char *comment) ...@@ -657,8 +657,7 @@ CommentProc(List *function, List *arguments, char *comment)
/* Look up the procedure */ /* Look up the procedure */
oid = LookupFuncNameTypeNames(function, arguments, oid = LookupFuncNameTypeNames(function, arguments, false);
"CommentProc");
/* Now, validate the user's ability to comment on this function */ /* Now, validate the user's ability to comment on this function */
...@@ -689,8 +688,7 @@ CommentOperator(List *opername, List *arguments, char *comment) ...@@ -689,8 +688,7 @@ CommentOperator(List *opername, List *arguments, char *comment)
Oid classoid; Oid classoid;
/* Look up the operator */ /* Look up the operator */
oid = LookupOperNameTypeNames(opername, typenode1, typenode2, oid = LookupOperNameTypeNames(opername, typenode1, typenode2, false);
"CommentOperator");
/* Valid user's ability to comment on this operator */ /* Valid user's ability to comment on this operator */
if (!pg_oper_ownercheck(oid, GetUserId())) if (!pg_oper_ownercheck(oid, GetUserId()))
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.6 2003/06/27 14:45:27 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.7 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -70,10 +70,8 @@ CreateConversionCommand(CreateConversionStmt *stmt) ...@@ -70,10 +70,8 @@ CreateConversionCommand(CreateConversionStmt *stmt)
* Check the existence of the conversion function. Function name could * Check the existence of the conversion function. Function name could
* be a qualified name. * be a qualified name.
*/ */
funcoid = LookupFuncName(func_name, sizeof(funcargs) / sizeof(Oid), funcargs); funcoid = LookupFuncName(func_name, sizeof(funcargs) / sizeof(Oid),
if (!OidIsValid(funcoid)) funcargs, false);
func_error("CreateConversion", func_name,
sizeof(funcargs) / sizeof(Oid), funcargs, NULL);
/* Check we have EXECUTE rights for the function */ /* Check we have EXECUTE rights for the function */
aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE); aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.26 2003/06/27 14:45:27 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.27 2003/07/04 02:51:33 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* These routines take the parse tree and pick out the * These routines take the parse tree and pick out the
...@@ -495,8 +495,7 @@ RemoveFunction(RemoveFuncStmt *stmt) ...@@ -495,8 +495,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
/* /*
* Find the function, do permissions and validity checks * Find the function, do permissions and validity checks
*/ */
funcOid = LookupFuncNameTypeNames(functionName, argTypes, funcOid = LookupFuncNameTypeNames(functionName, argTypes, false);
"RemoveFunction");
tup = SearchSysCache(PROCOID, tup = SearchSysCache(PROCOID,
ObjectIdGetDatum(funcOid), ObjectIdGetDatum(funcOid),
...@@ -607,7 +606,7 @@ RenameFunction(List *name, List *argtypes, const char *newname) ...@@ -607,7 +606,7 @@ RenameFunction(List *name, List *argtypes, const char *newname)
rel = heap_openr(ProcedureRelationName, RowExclusiveLock); rel = heap_openr(ProcedureRelationName, RowExclusiveLock);
procOid = LookupFuncNameTypeNames(name, argtypes, "RenameFunction"); procOid = LookupFuncNameTypeNames(name, argtypes, false);
tup = SearchSysCacheCopy(PROCOID, tup = SearchSysCacheCopy(PROCOID,
ObjectIdGetDatum(procOid), ObjectIdGetDatum(procOid),
...@@ -796,7 +795,7 @@ CreateCast(CreateCastStmt *stmt) ...@@ -796,7 +795,7 @@ CreateCast(CreateCastStmt *stmt)
funcid = LookupFuncNameTypeNames(stmt->func->funcname, funcid = LookupFuncNameTypeNames(stmt->func->funcname,
stmt->func->funcargs, stmt->func->funcargs,
"CreateCast"); false);
tuple = SearchSysCache(PROCOID, tuple = SearchSysCache(PROCOID,
ObjectIdGetDatum(funcid), ObjectIdGetDatum(funcid),
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.10 2003/06/27 14:45:27 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.11 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -155,19 +155,15 @@ DefineOpClass(CreateOpClassStmt *stmt) ...@@ -155,19 +155,15 @@ DefineOpClass(CreateOpClassStmt *stmt)
TypeName *typeName2 = (TypeName *) lsecond(item->args); TypeName *typeName2 = (TypeName *) lsecond(item->args);
operOid = LookupOperNameTypeNames(item->name, operOid = LookupOperNameTypeNames(item->name,
typeName1, typeName2, typeName1,
"DefineOpClass"); typeName2,
/* No need to check for error */ false);
} }
else else
{ {
/* Default to binary op on input datatype */ /* Default to binary op on input datatype */
operOid = LookupOperName(item->name, typeoid, typeoid); operOid = LookupOperName(item->name, typeoid, typeoid,
if (!OidIsValid(operOid)) false);
elog(ERROR, "DefineOpClass: Operator '%s' for types '%s' and '%s' does not exist",
NameListToString(item->name),
format_type_be(typeoid),
format_type_be(typeoid));
} }
/* Caller must have execute permission on operators */ /* Caller must have execute permission on operators */
funcOid = get_opcode(operOid); funcOid = get_opcode(operOid);
...@@ -187,7 +183,7 @@ DefineOpClass(CreateOpClassStmt *stmt) ...@@ -187,7 +183,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
elog(ERROR, "DefineOpClass: procedure number %d appears more than once", elog(ERROR, "DefineOpClass: procedure number %d appears more than once",
item->number); item->number);
funcOid = LookupFuncNameTypeNames(item->name, item->args, funcOid = LookupFuncNameTypeNames(item->name, item->args,
"DefineOpClass"); false);
/* Caller must have execute permission on functions */ /* Caller must have execute permission on functions */
aclresult = pg_proc_aclcheck(funcOid, GetUserId(), aclresult = pg_proc_aclcheck(funcOid, GetUserId(),
ACL_EXECUTE); ACL_EXECUTE);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.7 2002/09/04 20:31:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.8 2003/07/04 02:51:33 tgl 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
...@@ -206,14 +206,13 @@ RemoveOperator(RemoveOperStmt *stmt) ...@@ -206,14 +206,13 @@ RemoveOperator(RemoveOperStmt *stmt)
ObjectAddress object; ObjectAddress object;
operOid = LookupOperNameTypeNames(operatorName, typeName1, typeName2, operOid = LookupOperNameTypeNames(operatorName, typeName1, typeName2,
"RemoveOperator"); false);
tup = SearchSysCache(OPEROID, tup = SearchSysCache(OPEROID,
ObjectIdGetDatum(operOid), ObjectIdGetDatum(operOid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "RemoveOperator: failed to find tuple for operator '%s'", elog(ERROR, "cache lookup of operator %u failed", operOid);
NameListToString(operatorName));
/* Permission check: must own operator or its namespace */ /* Permission check: must own operator or its namespace */
if (!pg_oper_ownercheck(operOid, GetUserId()) && if (!pg_oper_ownercheck(operOid, GetUserId()) &&
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,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/commands/proclang.c,v 1.44 2003/06/27 14:45:27 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.45 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -77,10 +77,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) ...@@ -77,10 +77,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
* return type * return type
*/ */
MemSet(typev, 0, sizeof(typev)); MemSet(typev, 0, sizeof(typev));
procOid = LookupFuncName(stmt->plhandler, 0, typev); procOid = LookupFuncName(stmt->plhandler, 0, typev, false);
if (!OidIsValid(procOid))
elog(ERROR, "function %s() doesn't exist",
NameListToString(stmt->plhandler));
funcrettype = get_func_rettype(procOid); funcrettype = get_func_rettype(procOid);
if (funcrettype != LANGUAGE_HANDLEROID) if (funcrettype != LANGUAGE_HANDLEROID)
{ {
...@@ -104,10 +101,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) ...@@ -104,10 +101,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
if (stmt->plvalidator) if (stmt->plvalidator)
{ {
typev[0] = OIDOID; typev[0] = OIDOID;
valProcOid = LookupFuncName(stmt->plvalidator, 1, typev); valProcOid = LookupFuncName(stmt->plvalidator, 1, typev, false);
if (!OidIsValid(valProcOid))
elog(ERROR, "function %s(oid) doesn't exist",
NameListToString(stmt->plvalidator));
/* return value is ignored, so we don't check the type */ /* return value is ignored, so we don't check the type */
} }
else else
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,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/commands/trigger.c,v 1.149 2003/06/24 23:25:44 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.150 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -257,10 +257,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) ...@@ -257,10 +257,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
* Find and validate the trigger function. * Find and validate the trigger function.
*/ */
MemSet(fargtypes, 0, FUNC_MAX_ARGS * sizeof(Oid)); MemSet(fargtypes, 0, FUNC_MAX_ARGS * sizeof(Oid));
funcoid = LookupFuncName(stmt->funcname, 0, fargtypes); funcoid = LookupFuncName(stmt->funcname, 0, fargtypes, false);
if (!OidIsValid(funcoid))
elog(ERROR, "CreateTrigger: function %s() does not exist",
NameListToString(stmt->funcname));
funcrettype = get_func_rettype(funcoid); funcrettype = get_func_rettype(funcoid);
if (funcrettype != TRIGGEROID) if (funcrettype != TRIGGEROID)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.37 2003/06/06 15:04:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.38 2003/07/04 02:51:33 tgl 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
...@@ -789,14 +789,14 @@ findTypeInputFunction(List *procname, Oid typeOid) ...@@ -789,14 +789,14 @@ findTypeInputFunction(List *procname, Oid typeOid)
argList[0] = CSTRINGOID; argList[0] = CSTRINGOID;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
argList[1] = OIDOID; argList[1] = OIDOID;
argList[2] = INT4OID; argList[2] = INT4OID;
procOid = LookupFuncName(procname, 3, argList); procOid = LookupFuncName(procname, 3, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
...@@ -805,14 +805,14 @@ findTypeInputFunction(List *procname, Oid typeOid) ...@@ -805,14 +805,14 @@ findTypeInputFunction(List *procname, Oid typeOid)
argList[0] = OPAQUEOID; argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (!OidIsValid(procOid)) if (!OidIsValid(procOid))
{ {
argList[1] = OIDOID; argList[1] = OIDOID;
argList[2] = INT4OID; argList[2] = INT4OID;
procOid = LookupFuncName(procname, 3, argList); procOid = LookupFuncName(procname, 3, argList, true);
} }
if (OidIsValid(procOid)) if (OidIsValid(procOid))
...@@ -834,7 +834,8 @@ findTypeInputFunction(List *procname, Oid typeOid) ...@@ -834,7 +834,8 @@ findTypeInputFunction(List *procname, Oid typeOid)
/* Use CSTRING (preferred) in the error message */ /* Use CSTRING (preferred) in the error message */
argList[0] = CSTRINGOID; argList[0] = CSTRINGOID;
func_error("TypeCreate", procname, 1, argList, NULL); elog(ERROR, "function %s does not exist",
func_signature_string(procname, 1, argList));
return InvalidOid; /* keep compiler quiet */ return InvalidOid; /* keep compiler quiet */
} }
...@@ -857,13 +858,13 @@ findTypeOutputFunction(List *procname, Oid typeOid) ...@@ -857,13 +858,13 @@ findTypeOutputFunction(List *procname, Oid typeOid)
argList[0] = typeOid; argList[0] = typeOid;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
argList[1] = OIDOID; argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList); procOid = LookupFuncName(procname, 2, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
...@@ -872,13 +873,13 @@ findTypeOutputFunction(List *procname, Oid typeOid) ...@@ -872,13 +873,13 @@ findTypeOutputFunction(List *procname, Oid typeOid)
argList[0] = OPAQUEOID; argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (!OidIsValid(procOid)) if (!OidIsValid(procOid))
{ {
argList[1] = OIDOID; argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList); procOid = LookupFuncName(procname, 2, argList, true);
} }
if (OidIsValid(procOid)) if (OidIsValid(procOid))
...@@ -899,7 +900,8 @@ findTypeOutputFunction(List *procname, Oid typeOid) ...@@ -899,7 +900,8 @@ findTypeOutputFunction(List *procname, Oid typeOid)
/* Use type name, not OPAQUE, in the failure message. */ /* Use type name, not OPAQUE, in the failure message. */
argList[0] = typeOid; argList[0] = typeOid;
func_error("TypeCreate", procname, 1, argList, NULL); elog(ERROR, "function %s does not exist",
func_signature_string(procname, 1, argList));
return InvalidOid; /* keep compiler quiet */ return InvalidOid; /* keep compiler quiet */
} }
...@@ -918,17 +920,18 @@ findTypeReceiveFunction(List *procname, Oid typeOid) ...@@ -918,17 +920,18 @@ findTypeReceiveFunction(List *procname, Oid typeOid)
argList[0] = INTERNALOID; argList[0] = INTERNALOID;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
argList[1] = OIDOID; argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList); procOid = LookupFuncName(procname, 2, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
func_error("TypeCreate", procname, 1, argList, NULL); elog(ERROR, "function %s does not exist",
func_signature_string(procname, 1, argList));
return InvalidOid; /* keep compiler quiet */ return InvalidOid; /* keep compiler quiet */
} }
...@@ -947,17 +950,18 @@ findTypeSendFunction(List *procname, Oid typeOid) ...@@ -947,17 +950,18 @@ findTypeSendFunction(List *procname, Oid typeOid)
argList[0] = typeOid; argList[0] = typeOid;
procOid = LookupFuncName(procname, 1, argList); procOid = LookupFuncName(procname, 1, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
argList[1] = OIDOID; argList[1] = OIDOID;
procOid = LookupFuncName(procname, 2, argList); procOid = LookupFuncName(procname, 2, argList, true);
if (OidIsValid(procOid)) if (OidIsValid(procOid))
return procOid; return procOid;
func_error("TypeCreate", procname, 1, argList, NULL); elog(ERROR, "function %s does not exist",
func_signature_string(procname, 1, argList));
return InvalidOid; /* keep compiler quiet */ return InvalidOid; /* keep compiler quiet */
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.152 2003/06/25 21:30:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.153 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -294,10 +294,23 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, ...@@ -294,10 +294,23 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
/* /*
* Else generate a detailed complaint for a function * Else generate a detailed complaint for a function
*/ */
func_error(NULL, funcname, nargs, actual_arg_types, if (fdresult == FUNCDETAIL_MULTIPLE)
"Unable to identify a function that satisfies the " ereport(ERROR,
"given argument types" (errcode(ERRCODE_AMBIGUOUS_FUNCTION),
"\n\tYou may need to add explicit typecasts"); errmsg("function %s is not unique",
func_signature_string(funcname, nargs,
actual_arg_types)),
errhint("Unable to choose a best candidate function. "
"You may need to add explicit typecasts.")));
else
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("function %s does not exist",
func_signature_string(funcname, nargs,
actual_arg_types)),
errhint("No function matches the given name and argument types. "
"You may need to add explicit typecasts.")));
} }
/* /*
...@@ -874,11 +887,11 @@ func_get_detail(List *funcname, ...@@ -874,11 +887,11 @@ func_get_detail(List *funcname,
/* /*
* If we were able to choose a best candidate, we're * If we were able to choose a best candidate, we're
* done. Otherwise, ambiguous function call, so fail * done. Otherwise, ambiguous function call.
* by exiting loop with best_candidate still NULL.
* Either way, we're outta here.
*/ */
break; if (best_candidate)
break;
return FUNCDETAIL_MULTIPLE;
} }
/* /*
...@@ -908,7 +921,8 @@ func_get_detail(List *funcname, ...@@ -908,7 +921,8 @@ func_get_detail(List *funcname,
ObjectIdGetDatum(best_candidate->oid), ObjectIdGetDatum(best_candidate->oid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(ftup)) /* should not happen */ if (!HeapTupleIsValid(ftup)) /* should not happen */
elog(ERROR, "function %u not found", best_candidate->oid); elog(ERROR, "cache lookup of function %u failed",
best_candidate->oid);
pform = (Form_pg_proc) GETSTRUCT(ftup); pform = (Form_pg_proc) GETSTRUCT(ftup);
*rettype = pform->prorettype; *rettype = pform->prorettype;
*retset = pform->proretset; *retset = pform->proretset;
...@@ -918,7 +932,7 @@ func_get_detail(List *funcname, ...@@ -918,7 +932,7 @@ func_get_detail(List *funcname,
} }
return FUNCDETAIL_NOTFOUND; return FUNCDETAIL_NOTFOUND;
} /* func_get_detail() */ }
/* /*
* argtype_inherit() -- Construct an argtype vector reflecting the * argtype_inherit() -- Construct an argtype vector reflecting the
...@@ -1324,19 +1338,23 @@ unknown_attribute(const char *schemaname, const char *relname, ...@@ -1324,19 +1338,23 @@ unknown_attribute(const char *schemaname, const char *relname,
} }
/* /*
* Error message when function lookup fails that gives details of the * func_signature_string
* argument types * Build a string representing a function name, including arg types.
* The result is something like "foo(integer)".
*
* This is typically used in the construction of function-not-found error
* messages.
*/ */
void const char *
func_error(const char *caller, List *funcname, func_signature_string(List *funcname, int nargs, const Oid *argtypes)
int nargs, const Oid *argtypes,
const char *msg)
{ {
StringInfoData argbuf; StringInfoData argbuf;
int i; int i;
initStringInfo(&argbuf); initStringInfo(&argbuf);
appendStringInfo(&argbuf, "%s(", NameListToString(funcname));
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
if (i) if (i)
...@@ -1344,18 +1362,9 @@ func_error(const char *caller, List *funcname, ...@@ -1344,18 +1362,9 @@ func_error(const char *caller, List *funcname,
appendStringInfoString(&argbuf, format_type_be(argtypes[i])); appendStringInfoString(&argbuf, format_type_be(argtypes[i]));
} }
if (caller == NULL) appendStringInfoChar(&argbuf, ')');
{
elog(ERROR, "Function %s(%s) does not exist%s%s", return argbuf.data; /* return palloc'd string buffer */
NameListToString(funcname), argbuf.data,
((msg != NULL) ? "\n\t" : ""), ((msg != NULL) ? msg : ""));
}
else
{
elog(ERROR, "%s: function %s(%s) does not exist%s%s",
caller, NameListToString(funcname), argbuf.data,
((msg != NULL) ? "\n\t" : ""), ((msg != NULL) ? msg : ""));
}
} }
/* /*
...@@ -1367,23 +1376,24 @@ func_error(const char *caller, List *funcname, ...@@ -1367,23 +1376,24 @@ func_error(const char *caller, List *funcname,
* all types. * all types.
*/ */
Oid Oid
find_aggregate_func(const char *caller, List *aggname, Oid basetype) find_aggregate_func(List *aggname, Oid basetype, bool noError)
{ {
Oid oid; Oid oid;
HeapTuple ftup; HeapTuple ftup;
Form_pg_proc pform; Form_pg_proc pform;
oid = LookupFuncName(aggname, 1, &basetype); oid = LookupFuncName(aggname, 1, &basetype, true);
if (!OidIsValid(oid)) if (!OidIsValid(oid))
{ {
if (noError)
return InvalidOid;
if (basetype == ANYOID) if (basetype == ANYOID)
elog(ERROR, "%s: aggregate %s(*) does not exist", elog(ERROR, "aggregate %s(*) does not exist",
caller, NameListToString(aggname)); NameListToString(aggname));
else else
elog(ERROR, "%s: aggregate %s(%s) does not exist", elog(ERROR, "aggregate %s(%s) does not exist",
caller, NameListToString(aggname), NameListToString(aggname), format_type_be(basetype));
format_type_be(basetype));
} }
/* Make sure it's an aggregate */ /* Make sure it's an aggregate */
...@@ -1396,13 +1406,12 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype) ...@@ -1396,13 +1406,12 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
if (!pform->proisagg) if (!pform->proisagg)
{ {
if (basetype == ANYOID) ReleaseSysCache(ftup);
elog(ERROR, "%s: function %s(*) is not an aggregate", if (noError)
caller, NameListToString(aggname)); return InvalidOid;
else /* we do not use the (*) notation for functions... */
elog(ERROR, "%s: function %s(%s) is not an aggregate", elog(ERROR, "function %s(%s) is not an aggregate",
caller, NameListToString(aggname), NameListToString(aggname), format_type_be(basetype));
format_type_be(basetype));
} }
ReleaseSysCache(ftup); ReleaseSysCache(ftup);
...@@ -1413,13 +1422,16 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype) ...@@ -1413,13 +1422,16 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
/* /*
* LookupFuncName * LookupFuncName
* Given a possibly-qualified function name and a set of argument types, * Given a possibly-qualified function name and a set of argument types,
* look up the function. Returns InvalidOid if no such function. * look up the function.
* *
* If the function name is not schema-qualified, it is sought in the current * If the function name is not schema-qualified, it is sought in the current
* namespace search path. * namespace search path.
*
* If the function is not found, we return InvalidOid if noError is true,
* else raise an error.
*/ */
Oid Oid
LookupFuncName(List *funcname, int nargs, const Oid *argtypes) LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool noError)
{ {
FuncCandidateList clist; FuncCandidateList clist;
...@@ -1432,19 +1444,21 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes) ...@@ -1432,19 +1444,21 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes)
clist = clist->next; clist = clist->next;
} }
if (!noError)
elog(ERROR, "function %s does not exist",
func_signature_string(funcname, nargs, argtypes));
return InvalidOid; return InvalidOid;
} }
/* /*
* LookupFuncNameTypeNames * LookupFuncNameTypeNames
* Like LookupFuncName, but the argument types are specified by a * Like LookupFuncName, but the argument types are specified by a
* list of TypeName nodes. Also, if we fail to find the function * list of TypeName nodes.
* and caller is not NULL, then an error is reported via func_error.
*/ */
Oid Oid
LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller) LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
{ {
Oid funcoid;
Oid argoids[FUNC_MAX_ARGS]; Oid argoids[FUNC_MAX_ARGS];
int argcount; int argcount;
int i; int i;
...@@ -1468,10 +1482,5 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller) ...@@ -1468,10 +1482,5 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller)
argtypes = lnext(argtypes); argtypes = lnext(argtypes);
} }
funcoid = LookupFuncName(funcname, argcount, argoids); return LookupFuncName(funcname, argcount, argoids, noError);
if (!OidIsValid(funcoid) && caller != NULL)
func_error(caller, funcname, argcount, argoids, NULL);
return funcoid;
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.68 2003/06/29 00:33:43 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.69 2003/07/04 02:51:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "postgres.h" #include "postgres.h"
#include "catalog/pg_operator.h" #include "catalog/pg_operator.h"
#include "lib/stringinfo.h"
#include "parser/parse_coerce.h" #include "parser/parse_coerce.h"
#include "parser/parse_expr.h" #include "parser/parse_expr.h"
#include "parser/parse_func.h" #include "parser/parse_func.h"
...@@ -29,25 +30,32 @@ ...@@ -29,25 +30,32 @@
static Oid binary_oper_exact(Oid arg1, Oid arg2, static Oid binary_oper_exact(Oid arg1, Oid arg2,
FuncCandidateList candidates); FuncCandidateList candidates);
static Oid oper_select_candidate(int nargs, Oid *input_typeids, static FuncDetailCode oper_select_candidate(int nargs,
FuncCandidateList candidates); Oid *input_typeids,
static void op_error(List *op, Oid arg1, Oid arg2); FuncCandidateList candidates,
static void unary_op_error(List *op, Oid arg, bool is_left_op); Oid *operOid);
static const char *op_signature_string(List *op, char oprkind,
Oid arg1, Oid arg2);
static void op_error(List *op, char oprkind, Oid arg1, Oid arg2,
FuncDetailCode fdresult);
/* /*
* LookupOperName * LookupOperName
* Given a possibly-qualified operator name and exact input datatypes, * Given a possibly-qualified operator name and exact input datatypes,
* look up the operator. Returns InvalidOid if no such operator. * look up the operator.
* *
* Pass oprleft = InvalidOid for a prefix op, oprright = InvalidOid for * Pass oprleft = InvalidOid for a prefix op, oprright = InvalidOid for
* a postfix op. * a postfix op.
* *
* If the operator name is not schema-qualified, it is sought in the current * If the operator name is not schema-qualified, it is sought in the current
* namespace search path. * namespace search path.
*
* If the operator is not found, we return InvalidOid if noError is true,
* else raise an error.
*/ */
Oid Oid
LookupOperName(List *opername, Oid oprleft, Oid oprright) LookupOperName(List *opername, Oid oprleft, Oid oprright, bool noError)
{ {
FuncCandidateList clist; FuncCandidateList clist;
char oprkind; char oprkind;
...@@ -68,22 +76,28 @@ LookupOperName(List *opername, Oid oprleft, Oid oprright) ...@@ -68,22 +76,28 @@ LookupOperName(List *opername, Oid oprleft, Oid oprright)
clist = clist->next; clist = clist->next;
} }
/* we don't use op_error here because only an exact match is wanted */
if (!noError)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("operator does not exist: %s",
op_signature_string(opername, oprkind,
oprleft, oprright))));
return InvalidOid; return InvalidOid;
} }
/* /*
* LookupOperNameTypeNames * LookupOperNameTypeNames
* Like LookupOperName, but the argument types are specified by * Like LookupOperName, but the argument types are specified by
* TypeName nodes. Also, if we fail to find the operator * TypeName nodes.
* and caller is not NULL, then an error is reported.
* *
* Pass oprleft = NULL for a prefix op, oprright = NULL for a postfix op. * Pass oprleft = NULL for a prefix op, oprright = NULL for a postfix op.
*/ */
Oid Oid
LookupOperNameTypeNames(List *opername, TypeName *oprleft, LookupOperNameTypeNames(List *opername, TypeName *oprleft,
TypeName *oprright, const char *caller) TypeName *oprright, bool noError)
{ {
Oid operoid;
Oid leftoid, Oid leftoid,
rightoid; rightoid;
...@@ -93,7 +107,7 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft, ...@@ -93,7 +107,7 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft,
{ {
leftoid = LookupTypeName(oprleft); leftoid = LookupTypeName(oprleft);
if (!OidIsValid(leftoid)) if (!OidIsValid(leftoid))
elog(ERROR, "Type \"%s\" does not exist", elog(ERROR, "type %s does not exist",
TypeNameToString(oprleft)); TypeNameToString(oprleft));
} }
if (oprright == NULL) if (oprright == NULL)
...@@ -102,30 +116,11 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft, ...@@ -102,30 +116,11 @@ LookupOperNameTypeNames(List *opername, TypeName *oprleft,
{ {
rightoid = LookupTypeName(oprright); rightoid = LookupTypeName(oprright);
if (!OidIsValid(rightoid)) if (!OidIsValid(rightoid))
elog(ERROR, "Type \"%s\" does not exist", elog(ERROR, "type %s does not exist",
TypeNameToString(oprright));
}
operoid = LookupOperName(opername, leftoid, rightoid);
if (!OidIsValid(operoid) && caller != NULL)
{
if (oprleft == NULL)
elog(ERROR, "%s: Prefix operator '%s' for type '%s' does not exist",
caller, NameListToString(opername),
TypeNameToString(oprright));
else if (oprright == NULL)
elog(ERROR, "%s: Postfix operator '%s' for type '%s' does not exist",
caller, NameListToString(opername),
TypeNameToString(oprleft));
else
elog(ERROR, "%s: Operator '%s' for types '%s' and '%s' does not exist",
caller, NameListToString(opername),
TypeNameToString(oprleft),
TypeNameToString(oprright)); TypeNameToString(oprright));
} }
return operoid; return LookupOperName(opername, leftoid, rightoid, noError);
} }
/* /*
...@@ -183,7 +178,7 @@ equality_oper(Oid argtype, bool noError) ...@@ -183,7 +178,7 @@ equality_oper(Oid argtype, bool noError)
} }
} }
if (!noError) if (!noError)
elog(ERROR, "Unable to identify an equality operator for type %s", elog(ERROR, "unable to identify an equality operator for type %s",
format_type_be(argtype)); format_type_be(argtype));
return NULL; return NULL;
} }
...@@ -244,7 +239,7 @@ ordering_oper(Oid argtype, bool noError) ...@@ -244,7 +239,7 @@ ordering_oper(Oid argtype, bool noError)
} }
} }
if (!noError) if (!noError)
elog(ERROR, "Unable to identify an ordering operator for type %s" elog(ERROR, "unable to identify an ordering operator for type %s"
"\n\tUse an explicit ordering operator or modify the query", "\n\tUse an explicit ordering operator or modify the query",
format_type_be(argtype)); format_type_be(argtype));
return NULL; return NULL;
...@@ -347,17 +342,18 @@ binary_oper_exact(Oid arg1, Oid arg2, ...@@ -347,17 +342,18 @@ binary_oper_exact(Oid arg1, Oid arg2,
* Given the input argtype array and one or more candidates * Given the input argtype array and one or more candidates
* for the operator, attempt to resolve the conflict. * for the operator, attempt to resolve the conflict.
* *
* Returns the OID of the selected operator if the conflict can be resolved, * Returns FUNCDETAIL_NOTFOUND, FUNCDETAIL_MULTIPLE, or FUNCDETAIL_NORMAL.
* otherwise returns InvalidOid. * In the success case the Oid of the best candidate is stored in *operOid.
* *
* Note that the caller has already determined that there is no candidate * Note that the caller has already determined that there is no candidate
* exactly matching the input argtype(s). Incompatible candidates are not yet * exactly matching the input argtype(s). Incompatible candidates are not yet
* pruned away, however. * pruned away, however.
*/ */
static Oid static FuncDetailCode
oper_select_candidate(int nargs, oper_select_candidate(int nargs,
Oid *input_typeids, Oid *input_typeids,
FuncCandidateList candidates) FuncCandidateList candidates,
Oid *operOid) /* output argument */
{ {
int ncandidates; int ncandidates;
...@@ -370,9 +366,15 @@ oper_select_candidate(int nargs, ...@@ -370,9 +366,15 @@ oper_select_candidate(int nargs,
/* Done if no candidate or only one candidate survives */ /* Done if no candidate or only one candidate survives */
if (ncandidates == 0) if (ncandidates == 0)
return InvalidOid; {
*operOid = InvalidOid;
return FUNCDETAIL_NOTFOUND;
}
if (ncandidates == 1) if (ncandidates == 1)
return candidates->oid; {
*operOid = candidates->oid;
return FUNCDETAIL_NORMAL;
}
/* /*
* Use the same heuristics as for ambiguous functions to resolve * Use the same heuristics as for ambiguous functions to resolve
...@@ -381,10 +383,14 @@ oper_select_candidate(int nargs, ...@@ -381,10 +383,14 @@ oper_select_candidate(int nargs,
candidates = func_select_candidate(nargs, input_typeids, candidates); candidates = func_select_candidate(nargs, input_typeids, candidates);
if (candidates) if (candidates)
return candidates->oid; {
*operOid = candidates->oid;
return FUNCDETAIL_NORMAL;
}
return InvalidOid; /* failed to select a best candidate */ *operOid = InvalidOid;
} /* oper_select_candidate() */ return FUNCDETAIL_MULTIPLE; /* failed to select a best candidate */
}
/* oper() -- search for a binary operator /* oper() -- search for a binary operator
...@@ -404,8 +410,9 @@ Operator ...@@ -404,8 +410,9 @@ Operator
oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError) oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError)
{ {
FuncCandidateList clist; FuncCandidateList clist;
Oid operOid;
Oid inputOids[2]; Oid inputOids[2];
Oid operOid;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL; HeapTuple tup = NULL;
/* Get binary operators of given name */ /* Get binary operators of given name */
...@@ -434,7 +441,7 @@ oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError) ...@@ -434,7 +441,7 @@ oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError)
ltypeId = rtypeId; ltypeId = rtypeId;
inputOids[0] = ltypeId; inputOids[0] = ltypeId;
inputOids[1] = rtypeId; inputOids[1] = rtypeId;
operOid = oper_select_candidate(2, inputOids, clist); fdresult = oper_select_candidate(2, inputOids, clist, &operOid);
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache(OPEROID,
...@@ -443,7 +450,7 @@ oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError) ...@@ -443,7 +450,7 @@ oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError)
} }
if (!HeapTupleIsValid(tup) && !noError) if (!HeapTupleIsValid(tup) && !noError)
op_error(opname, ltypeId, rtypeId); op_error(opname, 'b', ltypeId, rtypeId, fdresult);
return (Operator) tup; return (Operator) tup;
} }
...@@ -476,7 +483,8 @@ compatible_oper(List *op, Oid arg1, Oid arg2, bool noError) ...@@ -476,7 +483,8 @@ compatible_oper(List *op, Oid arg1, Oid arg2, bool noError)
ReleaseSysCache(optup); ReleaseSysCache(optup);
if (!noError) if (!noError)
op_error(op, arg1, arg2); elog(ERROR, "operator requires run-time type coercion: %s",
op_signature_string(op, 'b', arg1, arg2));
return (Operator) NULL; return (Operator) NULL;
} }
...@@ -504,7 +512,7 @@ compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError) ...@@ -504,7 +512,7 @@ compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
} }
/* right_oper() -- search for a unary right operator (operator on right) /* right_oper() -- search for a unary right operator (postfix operator)
* Given operator name and type of arg, return oper struct. * Given operator name and type of arg, return oper struct.
* *
* IMPORTANT: the returned operator (if any) is only promised to be * IMPORTANT: the returned operator (if any) is only promised to be
...@@ -522,6 +530,7 @@ right_oper(List *op, Oid arg, bool noError) ...@@ -522,6 +530,7 @@ right_oper(List *op, Oid arg, bool noError)
{ {
FuncCandidateList clist; FuncCandidateList clist;
Oid operOid = InvalidOid; Oid operOid = InvalidOid;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL; HeapTuple tup = NULL;
/* Find candidates */ /* Find candidates */
...@@ -551,7 +560,7 @@ right_oper(List *op, Oid arg, bool noError) ...@@ -551,7 +560,7 @@ right_oper(List *op, Oid arg, bool noError)
* candidate, otherwise we may falsely return a * candidate, otherwise we may falsely return a
* non-type-compatible operator. * non-type-compatible operator.
*/ */
operOid = oper_select_candidate(1, &arg, clist); fdresult = oper_select_candidate(1, &arg, clist, &operOid);
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache(OPEROID,
...@@ -560,13 +569,13 @@ right_oper(List *op, Oid arg, bool noError) ...@@ -560,13 +569,13 @@ right_oper(List *op, Oid arg, bool noError)
} }
if (!HeapTupleIsValid(tup) && !noError) if (!HeapTupleIsValid(tup) && !noError)
unary_op_error(op, arg, FALSE); op_error(op, 'r', arg, InvalidOid, fdresult);
return (Operator) tup; return (Operator) tup;
} }
/* left_oper() -- search for a unary left operator (operator on left) /* left_oper() -- search for a unary left operator (prefix operator)
* Given operator name and type of arg, return oper struct. * Given operator name and type of arg, return oper struct.
* *
* IMPORTANT: the returned operator (if any) is only promised to be * IMPORTANT: the returned operator (if any) is only promised to be
...@@ -584,6 +593,7 @@ left_oper(List *op, Oid arg, bool noError) ...@@ -584,6 +593,7 @@ left_oper(List *op, Oid arg, bool noError)
{ {
FuncCandidateList clist; FuncCandidateList clist;
Oid operOid = InvalidOid; Oid operOid = InvalidOid;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL; HeapTuple tup = NULL;
/* Find candidates */ /* Find candidates */
...@@ -618,7 +628,7 @@ left_oper(List *op, Oid arg, bool noError) ...@@ -618,7 +628,7 @@ left_oper(List *op, Oid arg, bool noError)
* candidate, otherwise we may falsely return a * candidate, otherwise we may falsely return a
* non-type-compatible operator. * non-type-compatible operator.
*/ */
operOid = oper_select_candidate(1, &arg, clist); fdresult = oper_select_candidate(1, &arg, clist, &operOid);
} }
if (OidIsValid(operOid)) if (OidIsValid(operOid))
tup = SearchSysCache(OPEROID, tup = SearchSysCache(OPEROID,
...@@ -627,67 +637,59 @@ left_oper(List *op, Oid arg, bool noError) ...@@ -627,67 +637,59 @@ left_oper(List *op, Oid arg, bool noError)
} }
if (!HeapTupleIsValid(tup) && !noError) if (!HeapTupleIsValid(tup) && !noError)
unary_op_error(op, arg, TRUE); op_error(op, 'l', InvalidOid, arg, fdresult);
return (Operator) tup; return (Operator) tup;
} }
/*
/* op_error() * op_signature_string
* Give a somewhat useful error message when the operator for two types * Build a string representing an operator name, including arg type(s).
* is not found. * The result is something like "integer + integer".
*
* This is typically used in the construction of operator-not-found error
* messages.
*/ */
static void static const char *
op_error(List *op, Oid arg1, Oid arg2) op_signature_string(List *op, char oprkind, Oid arg1, Oid arg2)
{ {
if (!typeidIsValid(arg1)) StringInfoData argbuf;
elog(ERROR, "Left hand side of operator '%s' has an unknown type"
"\n\tProbably a bad attribute name", initStringInfo(&argbuf);
NameListToString(op));
if (oprkind != 'l')
if (!typeidIsValid(arg2)) appendStringInfo(&argbuf, "%s ", format_type_be(arg1));
elog(ERROR, "Right hand side of operator %s has an unknown type"
"\n\tProbably a bad attribute name", appendStringInfoString(&argbuf, NameListToString(op));
NameListToString(op));
if (oprkind != 'r')
elog(ERROR, "Unable to identify an operator '%s' for types '%s' and '%s'" appendStringInfo(&argbuf, " %s", format_type_be(arg2));
"\n\tYou will have to retype this query using an explicit cast",
NameListToString(op), return argbuf.data; /* return palloc'd string buffer */
format_type_be(arg1), format_type_be(arg2));
} }
/* unary_op_error() /*
* Give a somewhat useful error message when the operator for one type * op_error - utility routine to complain about an unresolvable operator
* is not found.
*/ */
static void static void
unary_op_error(List *op, Oid arg, bool is_left_op) op_error(List *op, char oprkind, Oid arg1, Oid arg2, FuncDetailCode fdresult)
{ {
if (!typeidIsValid(arg)) if (fdresult == FUNCDETAIL_MULTIPLE)
{ ereport(ERROR,
if (is_left_op) (errcode(ERRCODE_AMBIGUOUS_FUNCTION),
elog(ERROR, "operand of prefix operator '%s' has an unknown type" errmsg("operator is not unique: %s",
"\n\t(probably an invalid column reference)", op_signature_string(op, oprkind, arg1, arg2)),
NameListToString(op)); errhint("Unable to choose a best candidate operator. "
else "You may need to add explicit typecasts.")));
elog(ERROR, "operand of postfix operator '%s' has an unknown type"
"\n\t(probably an invalid column reference)",
NameListToString(op));
}
else else
{ ereport(ERROR,
if (is_left_op) (errcode(ERRCODE_UNDEFINED_FUNCTION),
elog(ERROR, "Unable to identify a prefix operator '%s' for type '%s'" errmsg("operator does not exist: %s",
"\n\tYou may need to add parentheses or an explicit cast", op_signature_string(op, oprkind, arg1, arg2)),
NameListToString(op), format_type_be(arg)); errhint("No operator matches the given name and argument type(s). "
else "You may need to add explicit typecasts.")));
elog(ERROR, "Unable to identify a postfix operator '%s' for type '%s'"
"\n\tYou may need to add parentheses or an explicit cast",
NameListToString(op), format_type_be(arg));
}
} }
/* /*
* make_op() * make_op()
* Operator expression construction. * Operator expression construction.
......
...@@ -3,7 +3,7 @@ ...@@ -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.144 2003/07/03 16:34:25 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.145 2003/07/04 02:51:34 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -3539,7 +3539,8 @@ generate_function_name(Oid funcid, int nargs, Oid *argtypes) ...@@ -3539,7 +3539,8 @@ generate_function_name(Oid funcid, int nargs, Oid *argtypes)
NIL, nargs, argtypes, NIL, nargs, argtypes,
&p_funcid, &p_rettype, &p_funcid, &p_rettype,
&p_retset, &p_true_typeids); &p_retset, &p_true_typeids);
if (p_result != FUNCDETAIL_NOTFOUND && p_funcid == funcid) if ((p_result == FUNCDETAIL_NORMAL || p_result == FUNCDETAIL_AGGREGATE) &&
p_funcid == funcid)
nspname = NULL; nspname = NULL;
else else
nspname = get_namespace_name(procform->pronamespace); nspname = get_namespace_name(procform->pronamespace);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_func.h,v 1.46 2003/05/26 00:11:28 tgl Exp $ * $Id: parse_func.h,v 1.47 2003/07/04 02:51:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,7 +33,8 @@ typedef struct _InhPaths ...@@ -33,7 +33,8 @@ typedef struct _InhPaths
/* Result codes for func_get_detail */ /* Result codes for func_get_detail */
typedef enum typedef enum
{ {
FUNCDETAIL_NOTFOUND, /* no suitable interpretation */ FUNCDETAIL_NOTFOUND, /* no matching function */
FUNCDETAIL_MULTIPLE, /* too many matching functions */
FUNCDETAIL_NORMAL, /* found a matching regular function */ FUNCDETAIL_NORMAL, /* found a matching regular function */
FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */ FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */
FUNCDETAIL_COERCION /* it's a type coercion request */ FUNCDETAIL_COERCION /* it's a type coercion request */
...@@ -65,15 +66,14 @@ extern void make_fn_arguments(ParseState *pstate, ...@@ -65,15 +66,14 @@ extern void make_fn_arguments(ParseState *pstate,
Oid *actual_arg_types, Oid *actual_arg_types,
Oid *declared_arg_types); Oid *declared_arg_types);
extern void func_error(const char *caller, List *funcname, extern const char *func_signature_string(List *funcname,
int nargs, const Oid *argtypes, int nargs, const Oid *argtypes);
const char *msg);
extern Oid find_aggregate_func(const char *caller, List *aggname, extern Oid find_aggregate_func(List *aggname, Oid basetype, bool noError);
Oid basetype);
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes); extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes,
bool noError);
extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes, extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
const char *caller); bool noError);
#endif /* PARSE_FUNC_H */ #endif /* PARSE_FUNC_H */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_oper.h,v 1.29 2003/06/29 00:33:44 tgl Exp $ * $Id: parse_oper.h,v 1.30 2003/07/04 02:51:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,9 +21,10 @@ ...@@ -21,9 +21,10 @@
typedef HeapTuple Operator; typedef HeapTuple Operator;
/* Routines to look up an operator given name and exact input type(s) */ /* Routines to look up an operator given name and exact input type(s) */
extern Oid LookupOperName(List *opername, Oid oprleft, Oid oprright); extern Oid LookupOperName(List *opername, Oid oprleft, Oid oprright,
bool noError);
extern Oid LookupOperNameTypeNames(List *opername, TypeName *oprleft, extern Oid LookupOperNameTypeNames(List *opername, TypeName *oprleft,
TypeName *oprright, const char *caller); TypeName *oprright, bool noError);
/* Routines to find operators matching a name and given input types */ /* Routines to find operators matching a name and given input types */
/* NB: the selected operator may require coercion of the input types! */ /* NB: the selected operator may require coercion of the input types! */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: elog.h,v 1.45 2003/06/30 16:47:02 tgl Exp $ * $Id: elog.h,v 1.46 2003/07/04 02:51:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -175,7 +175,35 @@ ...@@ -175,7 +175,35 @@
#define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4', '0','0','0') #define ERRCODE_WITH_CHECK_OPTION_VIOLATION MAKE_SQLSTATE('4','4', '0','0','0')
/* Implementation-defined error codes for PostgreSQL */ /* Implementation-defined error codes for PostgreSQL */
/* Where appropriate, we borrow SQLSTATE values from DB2 */
#define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X', '0','0','0') #define ERRCODE_INTERNAL_ERROR MAKE_SQLSTATE('X','X', '0','0','0')
#define ERRCODE_INSUFFICIENT_PRIVILEGE MAKE_SQLSTATE('4','2', '5','0','1')
#define ERRCODE_SYNTAX_ERROR MAKE_SQLSTATE('4','2', '6','0','1')
#define ERRCODE_UNTERMINATED_LITERAL MAKE_SQLSTATE('4','2', '6','0','3')
#define ERRCODE_INVALID_LITERAL MAKE_SQLSTATE('4','2', '6','0','6')
#define ERRCODE_TOO_MANY_ARGUMENTS MAKE_SQLSTATE('4','2', '6','0','5')
#define ERRCODE_UNDEFINED_COLUMN MAKE_SQLSTATE('4','2', '7','0','3')
/*
* Note: use the above SQL-standard error codes for undefined catalog, schema,
* prepared statement, or cursor names. Curiously, they don't define error
* codes for any other kinds of objects. We choose to define an errcode for
* undefined tables, as well as one for functions (also used for operators);
* all other names (rules, triggers, etc) are lumped as UNDEFINED_OBJECT.
* The same breakdown is used for "ambiguous" and "duplicate" complaints.
*/
#define ERRCODE_UNDEFINED_TABLE MAKE_SQLSTATE('4','2', '7','0','4')
#define ERRCODE_UNDEFINED_FUNCTION MAKE_SQLSTATE('4','2', '8','8','3')
#define ERRCODE_UNDEFINED_OBJECT MAKE_SQLSTATE('4','2', '7','0','5')
#define ERRCODE_AMBIGUOUS_COLUMN MAKE_SQLSTATE('4','2', '7','0','2')
#define ERRCODE_AMBIGUOUS_FUNCTION MAKE_SQLSTATE('4','2', '7','2','5')
#define ERRCODE_DUPLICATE_COLUMN MAKE_SQLSTATE('4','2', '7','1','1')
#define ERRCODE_DUPLICATE_TABLE MAKE_SQLSTATE('4','2', '7','2','2')
#define ERRCODE_DUPLICATE_FUNCTION MAKE_SQLSTATE('4','2', '7','2','3')
#define ERRCODE_DUPLICATE_OBJECT MAKE_SQLSTATE('4','2', '7','1','0')
#define ERRCODE_GROUPING_ERROR MAKE_SQLSTATE('4','2', '8','0','3')
#define ERRCODE_TYPE_MISMATCH MAKE_SQLSTATE('4','2', '8','0','4')
#define ERRCODE_CANNOT_COERCE MAKE_SQLSTATE('4','2', '8','4','6')
#define ERRCODE_INVALID_FOREIGN_KEY MAKE_SQLSTATE('4','2', '8','3','0')
/* Which __func__ symbol do we have, if any? */ /* Which __func__ symbol do we have, if any? */
......
...@@ -340,14 +340,14 @@ CREATE TEMP TABLE FKTABLE (ftest1 inet); ...@@ -340,14 +340,14 @@ CREATE TEMP TABLE FKTABLE (ftest1 inet);
-- This next should fail, because inet=int does not exist -- This next should fail, because inet=int does not exist
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This should also fail for the same reason, but here we -- This should also fail for the same reason, but here we
-- give the column name -- give the column name
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This should succeed, even though they are different types -- This should succeed, even though they are different types
-- because varchar=int does exist -- because varchar=int does exist
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
...@@ -368,30 +368,30 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo ...@@ -368,30 +368,30 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
-- Again, so should this... -- Again, so should this...
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest1, ptest2); references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
-- This fails because we mixed up the column ordering -- This fails because we mixed up the column ordering
CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet); CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest2, ptest1); references pktable(ptest2, ptest1);
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'integer' and 'inet' ERROR: operator does not exist: integer = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- As does this... -- As does this...
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
references pktable(ptest1, ptest2); references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- temp tables should go away by themselves, need not drop them. -- temp tables should go away by themselves, need not drop them.
-- test check constraint adding -- test check constraint adding
create table atacc1 ( test int ); create table atacc1 ( test int );
......
...@@ -111,7 +111,7 @@ create aggregate newavg2 (sfunc = int4pl, ...@@ -111,7 +111,7 @@ create aggregate newavg2 (sfunc = int4pl,
stype = int4, stype = int4,
finalfunc = int2um, finalfunc = int2um,
initcond = '0'); initcond = '0');
ERROR: AggregateCreate: function int2um(integer) does not exist ERROR: function int2um(integer) does not exist
-- left out basetype -- left out basetype
create aggregate newcnt1 (sfunc = int4inc, create aggregate newcnt1 (sfunc = int4inc,
stype = int4, stype = int4,
...@@ -146,10 +146,10 @@ drop aggregate newcnt (nonesuch); ...@@ -146,10 +146,10 @@ drop aggregate newcnt (nonesuch);
ERROR: Type "nonesuch" does not exist ERROR: Type "nonesuch" does not exist
-- no such aggregate -- no such aggregate
drop aggregate nonesuch (int4); drop aggregate nonesuch (int4);
ERROR: RemoveAggregate: aggregate nonesuch(integer) does not exist ERROR: aggregate nonesuch(integer) does not exist
-- no such aggregate for type -- no such aggregate for type
drop aggregate newcnt (float4); drop aggregate newcnt (float4);
ERROR: RemoveAggregate: aggregate newcnt(real) does not exist ERROR: aggregate newcnt(real) does not exist
-- --
-- DROP FUNCTION -- DROP FUNCTION
...@@ -161,7 +161,7 @@ drop function 314159(); ...@@ -161,7 +161,7 @@ drop function 314159();
ERROR: syntax error at or near "314159" at character 15 ERROR: syntax error at or near "314159" at character 15
-- no such function -- no such function
drop function nonesuch(); drop function nonesuch();
ERROR: RemoveFunction: function nonesuch() does not exist ERROR: function nonesuch() does not exist
-- --
-- DROP TYPE -- DROP TYPE
...@@ -200,7 +200,7 @@ drop operator === (int4); ...@@ -200,7 +200,7 @@ drop operator === (int4);
ERROR: parser: argument type missing (use NONE for unary operators) ERROR: parser: argument type missing (use NONE for unary operators)
-- no such operator by that name -- no such operator by that name
drop operator === (int4, int4); drop operator === (int4, int4);
ERROR: RemoveOperator: Operator '===' for types 'int4' and 'int4' does not exist ERROR: operator does not exist: integer === integer
-- no such type1 -- no such type1
drop operator = (nonesuch); drop operator = (nonesuch);
ERROR: parser: argument type missing (use NONE for unary operators) ERROR: parser: argument type missing (use NONE for unary operators)
...@@ -209,10 +209,10 @@ drop operator = ( , int4); ...@@ -209,10 +209,10 @@ drop operator = ( , int4);
ERROR: syntax error at or near "," at character 19 ERROR: syntax error at or near "," at character 19
-- no such type1 -- no such type1
drop operator = (nonesuch, int4); drop operator = (nonesuch, int4);
ERROR: Type "nonesuch" does not exist ERROR: type nonesuch does not exist
-- no such type2 -- no such type2
drop operator = (int4, nonesuch); drop operator = (int4, nonesuch);
ERROR: Type "nonesuch" does not exist ERROR: type nonesuch does not exist
-- no such type2 -- no such type2
drop operator = (int4, ); drop operator = (int4, );
ERROR: syntax error at or near ")" at character 24 ERROR: syntax error at or near ")" at character 24
......
...@@ -716,14 +716,14 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo ...@@ -716,14 +716,14 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo
-- This next should fail, because inet=int does not exist -- This next should fail, because inet=int does not exist
CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable); CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This should also fail for the same reason, but here we -- This should also fail for the same reason, but here we
-- give the column name -- give the column name
CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable(ptest1)); CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable(ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This should succeed, even though they are different types -- This should succeed, even though they are different types
-- because varchar=int does exist -- because varchar=int does exist
CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable); CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable);
...@@ -740,28 +740,28 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo ...@@ -740,28 +740,28 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo
-- This should fail, because we just chose really odd types -- This should fail, because we just chose really odd types
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- Again, so should this... -- Again, so should this...
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2)); CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This fails because we mixed up the column ordering -- This fails because we mixed up the column ordering
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable); CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- As does this... -- As does this...
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2)); CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- And again.. -- And again..
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1)); CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'integer' and 'inet' ERROR: operator does not exist: integer = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- This works... -- This works...
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1)); CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
...@@ -789,22 +789,22 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY ...@@ -789,22 +789,22 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY
ptest4) REFERENCES pktable(ptest2, ptest1)); ptest4) REFERENCES pktable(ptest2, ptest1));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'integer' and 'inet' ERROR: operator does not exist: integer = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types -- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
ptest3) REFERENCES pktable(ptest1, ptest2)); ptest3) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- Not this one either... Same as the last one except we didn't defined the columns being referenced. -- Not this one either... Same as the last one except we didn't defined the columns being referenced.
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
ptest3) REFERENCES pktable); ptest3) REFERENCES pktable);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- --
-- Now some cases with inheritance -- Now some cases with inheritance
-- Basic 2 table case: 1 column of matching types. -- Basic 2 table case: 1 column of matching types.
...@@ -895,25 +895,25 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo ...@@ -895,25 +895,25 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' fo
-- just generally bad types (with and without column references on the referenced table) -- just generally bad types (with and without column references on the referenced table)
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable); create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1)); create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' ERROR: operator does not exist: cidr = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- let's mix up which columns reference which -- let's mix up which columns reference which
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable); create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable(base1, ptest1)); create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable(base1, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest1, ftest2) references pktable(ptest1, base1)); create table fktable(ftest1 int, ftest2 inet, foreign key(ftest1, ftest2) references pktable(ptest1, base1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'integer' and 'inet' ERROR: operator does not exist: integer = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
drop table pktable; drop table pktable;
drop table pktable_base; drop table pktable_base;
-- 2 columns (1 table), mismatched types -- 2 columns (1 table), mismatched types
...@@ -922,26 +922,26 @@ create table pktable(ptest1 inet, ptest2 inet[], primary key(base1, ptest1), for ...@@ -922,26 +922,26 @@ create table pktable(ptest1 inet, ptest2 inet[], primary key(base1, ptest1), for
pktable(base1, ptest1)) inherits (pktable_base); pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet[]' and 'inet' ERROR: operator does not exist: inet[] = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(base2, ptest2) references create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(base2, ptest2) references
pktable(ptest1, base1)) inherits (pktable_base); pktable(ptest1, base1)) inherits (pktable_base);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'integer' and 'inet' ERROR: operator does not exist: integer = inet
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references
pktable(base1, ptest1)) inherits (pktable_base); pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references
pktable(base1, ptest1)) inherits (pktable_base); pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'inet' and 'integer' ERROR: operator does not exist: inet = integer
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
drop table pktable; drop table pktable;
ERROR: table "pktable" does not exist ERROR: table "pktable" does not exist
drop table pktable_base; drop table pktable_base;
......
...@@ -104,8 +104,8 @@ SELECT '' AS one, p1.f1 ...@@ -104,8 +104,8 @@ SELECT '' AS one, p1.f1
-- intersection -- intersection
SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
FROM LSEG_TBL l, POINT_TBL p; FROM LSEG_TBL l, POINT_TBL p;
ERROR: Unable to identify an operator '#' for types 'lseg' and 'point' ERROR: operator does not exist: lseg # point
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- closest point -- closest point
SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
FROM LSEG_TBL l, POINT_TBL p; FROM LSEG_TBL l, POINT_TBL p;
......
...@@ -104,8 +104,8 @@ SELECT '' AS one, p1.f1 ...@@ -104,8 +104,8 @@ SELECT '' AS one, p1.f1
-- intersection -- intersection
SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
FROM LSEG_TBL l, POINT_TBL p; FROM LSEG_TBL l, POINT_TBL p;
ERROR: Unable to identify an operator '#' for types 'lseg' and 'point' ERROR: operator does not exist: lseg # point
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- closest point -- closest point
SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
FROM LSEG_TBL l, POINT_TBL p; FROM LSEG_TBL l, POINT_TBL p;
......
...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time"; ...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
(1 row) (1 row)
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC"; SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
ERROR: Unable to identify an operator '-' for types 'date' and 'time with time zone' ERROR: operator does not exist: date - time with time zone
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- --
-- timestamp, interval arithmetic -- timestamp, interval arithmetic
-- --
...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' ...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days'
Feb 23, 285506 Feb 23, 285506
---------------------------- ----------------------------
Fri Feb 23 00:00:00 285506 Fri Feb 23 00:00:00 285506
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
Jan 20, 288244 Jan 20, 288244
---------------------------- ----------------------------
Sat Jan 20 00:00:00 288244 Sat Jan 20 00:00:00 288244
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
Dec 31, 294276 Dec 31, 294276
---------------------------- ----------------------------
Sun Dec 31 00:00:00 294276 Sun Dec 31 00:00:00 294276
(1 row) (1 row)
SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days"; SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
106751991 Days 106751991 Days
------------------ ------------------
......
...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time"; ...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
(1 row) (1 row)
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC"; SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
ERROR: Unable to identify an operator '-' for types 'date' and 'time with time zone' ERROR: operator does not exist: date - time with time zone
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- --
-- timestamp, interval arithmetic -- timestamp, interval arithmetic
-- --
...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' ...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days'
Feb 23, 285506 Feb 23, 285506
---------------------------- ----------------------------
Fri Feb 23 00:00:00 285506 Fri Feb 23 00:00:00 285506
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
Jan 20, 288244 Jan 20, 288244
---------------------------- ----------------------------
Sat Jan 20 00:00:00 288244 Sat Jan 20 00:00:00 288244
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
Dec 31, 294276 Dec 31, 294276
---------------------------- ----------------------------
Sun Dec 31 00:00:00 294276 Sun Dec 31 00:00:00 294276
(1 row) (1 row)
SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days"; SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
106751991 Days 106751991 Days
------------------ ------------------
......
...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time"; ...@@ -299,8 +299,8 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
(1 row) (1 row)
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC"; SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
ERROR: Unable to identify an operator '-' for types 'date' and 'time with time zone' ERROR: operator does not exist: date - time with time zone
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
-- --
-- timestamp, interval arithmetic -- timestamp, interval arithmetic
-- --
...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' ...@@ -332,20 +332,20 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days'
Feb 23, 285506 Feb 23, 285506
---------------------------- ----------------------------
Fri Feb 23 00:00:00 285506 Fri Feb 23 00:00:00 285506
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
Jan 20, 288244 Jan 20, 288244
---------------------------- ----------------------------
Sat Jan 20 00:00:00 288244 Sat Jan 20 00:00:00 288244
(1 row) (1 row)
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276"; SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
Dec 31, 294276 Dec 31, 294276
---------------------------- ----------------------------
Sun Dec 31 00:00:00 294276 Sun Dec 31 00:00:00 294276
(1 row) (1 row)
SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days"; SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
106751991 Days 106751991 Days
------------------ ------------------
......
...@@ -107,7 +107,7 @@ CREATE AGGREGATE myaggp06a(BASETYPE = int, SFUNC = tf2p, STYPE = int[], ...@@ -107,7 +107,7 @@ CREATE AGGREGATE myaggp06a(BASETYPE = int, SFUNC = tf2p, STYPE = int[],
-- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int) -- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int)
CREATE AGGREGATE myaggp07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], CREATE AGGREGATE myaggp07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[],
FINALFUNC = ffp, INITCOND = '{}'); FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(integer[], anyelement) does not exist ERROR: function tfnp(integer[], anyelement) does not exist
-- N N P P -- N N P P
-- should CREATE -- should CREATE
CREATE AGGREGATE myaggp08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[], CREATE AGGREGATE myaggp08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[],
...@@ -128,18 +128,18 @@ CREATE AGGREGATE myaggp10b(BASETYPE = int, SFUNC = tfp, STYPE = int[], ...@@ -128,18 +128,18 @@ CREATE AGGREGATE myaggp10b(BASETYPE = int, SFUNC = tfp, STYPE = int[],
-- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int) -- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int)
CREATE AGGREGATE myaggp11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], CREATE AGGREGATE myaggp11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[],
FINALFUNC = ffp, INITCOND = '{}'); FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(integer[], anyelement) does not exist ERROR: function tf1p(integer[], anyelement) does not exist
CREATE AGGREGATE myaggp11b(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], CREATE AGGREGATE myaggp11b(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[],
INITCOND = '{}'); INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(integer[], anyelement) does not exist ERROR: function tf1p(integer[], anyelement) does not exist
-- N P P P -- N P P P
-- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement) -- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement)
CREATE AGGREGATE myaggp12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], CREATE AGGREGATE myaggp12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[],
FINALFUNC = ffp, INITCOND = '{}'); FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tfp(integer[], anyelement) does not exist ERROR: function tfp(integer[], anyelement) does not exist
CREATE AGGREGATE myaggp12b(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], CREATE AGGREGATE myaggp12b(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[],
INITCOND = '{}'); INITCOND = '{}');
ERROR: AggregateCreate: function tfp(integer[], anyelement) does not exist ERROR: function tfp(integer[], anyelement) does not exist
-- P N N N -- P N N N
-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int) -- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int)
CREATE AGGREGATE myaggp13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, CREATE AGGREGATE myaggp13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
...@@ -154,12 +154,12 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o ...@@ -154,12 +154,12 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o
-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int) -- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int)
CREATE AGGREGATE myaggp15a(BASETYPE = anyelement, SFUNC = tfnp, CREATE AGGREGATE myaggp15a(BASETYPE = anyelement, SFUNC = tfnp,
STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(anyarray, anyelement) does not exist ERROR: function tfnp(anyarray, anyelement) does not exist
-- P N P P -- P N P P
-- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement) -- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement)
CREATE AGGREGATE myaggp16a(BASETYPE = anyelement, SFUNC = tf2p, CREATE AGGREGATE myaggp16a(BASETYPE = anyelement, SFUNC = tf2p,
STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tf2p(anyarray, anyelement) does not exist ERROR: function tf2p(anyarray, anyelement) does not exist
-- P P N N -- P P N N
-- should ERROR: we have no way to resolve S -- should ERROR: we have no way to resolve S
CREATE AGGREGATE myaggp17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, CREATE AGGREGATE myaggp17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
...@@ -180,10 +180,10 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o ...@@ -180,10 +180,10 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o
-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int) -- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int)
CREATE AGGREGATE myaggp19a(BASETYPE = anyelement, SFUNC = tf1p, CREATE AGGREGATE myaggp19a(BASETYPE = anyelement, SFUNC = tf1p,
STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(anyarray, anyelement) does not exist ERROR: function tf1p(anyarray, anyelement) does not exist
CREATE AGGREGATE myaggp19b(BASETYPE = anyelement, SFUNC = tf1p, CREATE AGGREGATE myaggp19b(BASETYPE = anyelement, SFUNC = tf1p,
STYPE = anyarray, INITCOND = '{}'); STYPE = anyarray, INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(anyarray, anyelement) does not exist ERROR: function tf1p(anyarray, anyelement) does not exist
-- P P P P -- P P P P
-- should CREATE -- should CREATE
CREATE AGGREGATE myaggp20a(BASETYPE = anyelement, SFUNC = tfp, CREATE AGGREGATE myaggp20a(BASETYPE = anyelement, SFUNC = tfp,
...@@ -237,10 +237,10 @@ CREATE AGGREGATE myaggn06b(BASETYPE = int, SFUNC = tf2p, STYPE = int[], ...@@ -237,10 +237,10 @@ CREATE AGGREGATE myaggn06b(BASETYPE = int, SFUNC = tf2p, STYPE = int[],
-- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int) -- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int)
CREATE AGGREGATE myaggn07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], CREATE AGGREGATE myaggn07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[],
FINALFUNC = ffnp, INITCOND = '{}'); FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(integer[], anyelement) does not exist ERROR: function tfnp(integer[], anyelement) does not exist
CREATE AGGREGATE myaggn07b(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], CREATE AGGREGATE myaggn07b(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[],
INITCOND = '{}'); INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(integer[], anyelement) does not exist ERROR: function tfnp(integer[], anyelement) does not exist
-- N N P P -- N N P P
-- should CREATE -- should CREATE
CREATE AGGREGATE myaggn08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[], CREATE AGGREGATE myaggn08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[],
...@@ -259,12 +259,12 @@ CREATE AGGREGATE myaggn10a(BASETYPE = int, SFUNC = tfp, STYPE = int[], ...@@ -259,12 +259,12 @@ CREATE AGGREGATE myaggn10a(BASETYPE = int, SFUNC = tfp, STYPE = int[],
-- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int) -- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int)
CREATE AGGREGATE myaggn11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], CREATE AGGREGATE myaggn11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[],
FINALFUNC = ffnp, INITCOND = '{}'); FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(integer[], anyelement) does not exist ERROR: function tf1p(integer[], anyelement) does not exist
-- N P P P -- N P P P
-- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement) -- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement)
CREATE AGGREGATE myaggn12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], CREATE AGGREGATE myaggn12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[],
FINALFUNC = ffnp, INITCOND = '{}'); FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tfp(integer[], anyelement) does not exist ERROR: function tfp(integer[], anyelement) does not exist
-- P N N N -- P N N N
-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int) -- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int)
CREATE AGGREGATE myaggn13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, CREATE AGGREGATE myaggn13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
...@@ -285,18 +285,18 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o ...@@ -285,18 +285,18 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o
-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int) -- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int)
CREATE AGGREGATE myaggn15a(BASETYPE = anyelement, SFUNC = tfnp, CREATE AGGREGATE myaggn15a(BASETYPE = anyelement, SFUNC = tfnp,
STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(anyarray, anyelement) does not exist ERROR: function tfnp(anyarray, anyelement) does not exist
CREATE AGGREGATE myaggn15b(BASETYPE = anyelement, SFUNC = tfnp, CREATE AGGREGATE myaggn15b(BASETYPE = anyelement, SFUNC = tfnp,
STYPE = anyarray, INITCOND = '{}'); STYPE = anyarray, INITCOND = '{}');
ERROR: AggregateCreate: function tfnp(anyarray, anyelement) does not exist ERROR: function tfnp(anyarray, anyelement) does not exist
-- P N P P -- P N P P
-- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement) -- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement)
CREATE AGGREGATE myaggn16a(BASETYPE = anyelement, SFUNC = tf2p, CREATE AGGREGATE myaggn16a(BASETYPE = anyelement, SFUNC = tf2p,
STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tf2p(anyarray, anyelement) does not exist ERROR: function tf2p(anyarray, anyelement) does not exist
CREATE AGGREGATE myaggn16b(BASETYPE = anyelement, SFUNC = tf2p, CREATE AGGREGATE myaggn16b(BASETYPE = anyelement, SFUNC = tf2p,
STYPE = anyarray, INITCOND = '{}'); STYPE = anyarray, INITCOND = '{}');
ERROR: AggregateCreate: function tf2p(anyarray, anyelement) does not exist ERROR: function tf2p(anyarray, anyelement) does not exist
-- P P N N -- P P N N
-- should ERROR: ffnp(anyarray) not matched by ffnp(int[]) -- should ERROR: ffnp(anyarray) not matched by ffnp(int[])
CREATE AGGREGATE myaggn17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, CREATE AGGREGATE myaggn17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
...@@ -311,12 +311,12 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o ...@@ -311,12 +311,12 @@ ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have o
-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int) -- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int)
CREATE AGGREGATE myaggn19a(BASETYPE = anyelement, SFUNC = tf1p, CREATE AGGREGATE myaggn19a(BASETYPE = anyelement, SFUNC = tf1p,
STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function tf1p(anyarray, anyelement) does not exist ERROR: function tf1p(anyarray, anyelement) does not exist
-- P P P P -- P P P P
-- should ERROR: ffnp(anyarray) not matched by ffnp(int[]) -- should ERROR: ffnp(anyarray) not matched by ffnp(int[])
CREATE AGGREGATE myaggn20a(BASETYPE = anyelement, SFUNC = tfp, CREATE AGGREGATE myaggn20a(BASETYPE = anyelement, SFUNC = tfp,
STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}');
ERROR: AggregateCreate: function ffnp(anyarray) does not exist ERROR: function ffnp(anyarray) does not exist
-- create test data for polymorphic aggregates -- create test data for polymorphic aggregates
create temp table t(f1 int, f2 int[], f3 text); create temp table t(f1 int, f2 int[], f3 text);
insert into t values(1,array[1],'a'); insert into t values(1,array[1],'a');
......
...@@ -235,7 +235,7 @@ GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error ...@@ -235,7 +235,7 @@ GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error
ERROR: invalid privilege type USAGE for function object ERROR: invalid privilege type USAGE for function object
GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4; GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4;
GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4; GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4;
ERROR: GRANT: function testfunc_nosuch(integer) does not exist ERROR: function testfunc_nosuch(integer) does not exist
CREATE FUNCTION testfunc4(boolean) RETURNS text CREATE FUNCTION testfunc4(boolean) RETURNS text
AS 'select col1 from atest2 where col2 = $1;' AS 'select col1 from atest2 where col2 = $1;'
LANGUAGE sql SECURITY DEFINER; LANGUAGE sql SECURITY DEFINER;
......
...@@ -69,5 +69,5 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; ...@@ -69,5 +69,5 @@ SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00';
-- and do the rest of the testing in horology.sql -- and do the rest of the testing in horology.sql
-- where we do mixed-type arithmetic. - thomas 2000-12-02 -- where we do mixed-type arithmetic. - thomas 2000-12-02
SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
ERROR: Unable to identify an operator '+' for types 'time without time zone' and 'time without time zone' ERROR: operator is not unique: time without time zone + time without time zone
You will have to retype this query using an explicit cast HINT: Unable to choose a best candidate operator. You may need to add explicit typecasts.
...@@ -76,5 +76,5 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; ...@@ -76,5 +76,5 @@ SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07';
-- and do the rest of the testing in horology.sql -- and do the rest of the testing in horology.sql
-- where we do mixed-type arithmetic. - thomas 2000-12-02 -- where we do mixed-type arithmetic. - thomas 2000-12-02
SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL;
ERROR: Unable to identify an operator '+' for types 'time with time zone' and 'time with time zone' ERROR: operator does not exist: time with time zone + time with time zone
You will have to retype this query using an explicit cast HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
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