mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Don't pass oidvector by value.
Since the structure ends with a flexible array, doing so truncates any vector having more than one element. New in 9.3, so no back-patch.
This commit is contained in:
parent
fb435f40d5
commit
813895e4ac
@ -231,7 +231,7 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
|
|||||||
Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(oldtup);
|
Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(oldtup);
|
||||||
|
|
||||||
IsThereFunctionInNamespace(new_name, proc->pronargs,
|
IsThereFunctionInNamespace(new_name, proc->pronargs,
|
||||||
proc->proargtypes, proc->pronamespace);
|
&proc->proargtypes, proc->pronamespace);
|
||||||
}
|
}
|
||||||
else if (classId == CollationRelationId)
|
else if (classId == CollationRelationId)
|
||||||
{
|
{
|
||||||
@ -611,7 +611,7 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
|
|||||||
Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(tup);
|
Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(tup);
|
||||||
|
|
||||||
IsThereFunctionInNamespace(NameStr(proc->proname), proc->pronargs,
|
IsThereFunctionInNamespace(NameStr(proc->proname), proc->pronargs,
|
||||||
proc->proargtypes, nspOid);
|
&proc->proargtypes, nspOid);
|
||||||
}
|
}
|
||||||
else if (classId == CollationRelationId)
|
else if (classId == CollationRelationId)
|
||||||
{
|
{
|
||||||
|
@ -1626,18 +1626,18 @@ DropCastById(Oid castOid)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
IsThereFunctionInNamespace(const char *proname, int pronargs,
|
IsThereFunctionInNamespace(const char *proname, int pronargs,
|
||||||
oidvector proargtypes, Oid nspOid)
|
oidvector *proargtypes, Oid nspOid)
|
||||||
{
|
{
|
||||||
/* check for duplicate name (more friendly than unique-index failure) */
|
/* check for duplicate name (more friendly than unique-index failure) */
|
||||||
if (SearchSysCacheExists3(PROCNAMEARGSNSP,
|
if (SearchSysCacheExists3(PROCNAMEARGSNSP,
|
||||||
CStringGetDatum(proname),
|
CStringGetDatum(proname),
|
||||||
PointerGetDatum(&proargtypes),
|
PointerGetDatum(proargtypes),
|
||||||
ObjectIdGetDatum(nspOid)))
|
ObjectIdGetDatum(nspOid)))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DUPLICATE_FUNCTION),
|
(errcode(ERRCODE_DUPLICATE_FUNCTION),
|
||||||
errmsg("function %s already exists in schema \"%s\"",
|
errmsg("function %s already exists in schema \"%s\"",
|
||||||
funcname_signature_string(proname, pronargs,
|
funcname_signature_string(proname, pronargs,
|
||||||
NIL, proargtypes.values),
|
NIL, proargtypes->values),
|
||||||
get_namespace_name(nspOid))));
|
get_namespace_name(nspOid))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ extern Oid AlterFunction(AlterFunctionStmt *stmt);
|
|||||||
extern Oid CreateCast(CreateCastStmt *stmt);
|
extern Oid CreateCast(CreateCastStmt *stmt);
|
||||||
extern void DropCastById(Oid castOid);
|
extern void DropCastById(Oid castOid);
|
||||||
extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
|
extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
|
||||||
oidvector proargtypes, Oid nspOid);
|
oidvector *proargtypes, Oid nspOid);
|
||||||
extern void ExecuteDoStmt(DoStmt *stmt);
|
extern void ExecuteDoStmt(DoStmt *stmt);
|
||||||
extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
|
extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user