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

Make DROP FUNCTION hint more informative.

If you decide you want to take the hint, this gives you something you
can paste right back to the server.

Dean Rasheed
This commit is contained in:
Robert Haas
2012-06-26 13:33:23 -04:00
parent 76837c1507
commit 0caa0d04db
3 changed files with 15 additions and 10 deletions

View File

@@ -404,7 +404,8 @@ ProcedureCreate(const char *procedureName,
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("cannot change return type of existing function"),
errhint("Use DROP FUNCTION first.")));
errhint("Use DROP FUNCTION %s first.",
format_procedure(HeapTupleGetOid(oldtup)))));
/*
* If it returns RECORD, check for possible change of record type
@@ -427,7 +428,8 @@ ProcedureCreate(const char *procedureName,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("cannot change return type of existing function"),
errdetail("Row type defined by OUT parameters is different."),
errhint("Use DROP FUNCTION first.")));
errhint("Use DROP FUNCTION %s first.",
format_procedure(HeapTupleGetOid(oldtup)))));
}
/*
@@ -469,7 +471,8 @@ ProcedureCreate(const char *procedureName,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("cannot change name of input parameter \"%s\"",
old_arg_names[j]),
errhint("Use DROP FUNCTION first.")));
errhint("Use DROP FUNCTION %s first.",
format_procedure(HeapTupleGetOid(oldtup)))));
}
}
@@ -492,7 +495,8 @@ ProcedureCreate(const char *procedureName,
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("cannot remove parameter defaults from existing function"),
errhint("Use DROP FUNCTION first.")));
errhint("Use DROP FUNCTION %s first.",
format_procedure(HeapTupleGetOid(oldtup)))));
proargdefaults = SysCacheGetAttr(PROCNAMEARGSNSP, oldtup,
Anum_pg_proc_proargdefaults,
@@ -518,7 +522,8 @@ ProcedureCreate(const char *procedureName,
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("cannot change data type of existing parameter default value"),
errhint("Use DROP FUNCTION first.")));
errhint("Use DROP FUNCTION %s first.",
format_procedure(HeapTupleGetOid(oldtup)))));
newlc = lnext(newlc);
}
}