mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Rework order of checks in ALTER / SET SCHEMA
When attempting to move an object into the schema in which it already was, for most objects classes we were correctly complaining about exactly that ("object is already in schema"); but for some other object classes, such as functions, we were instead complaining of a name collision ("object already exists in schema"). The latter is wrong and misleading, per complaint from Robert Haas in CA+TgmoZ0+gNf7RDKRc3u5rHXffP=QjqPZKGxb4BsPz65k7qnHQ@mail.gmail.com To fix, refactor the way these checks are done. As a bonus, the resulting code is smaller and can also share some code with Rename cases. While at it, remove use of getObjectDescriptionOids() in error messages. These are normally disallowed because of translatability considerations, but this one had slipped through since 9.1. (Not sure that this is worth backpatching, though, as it would create some untranslated messages in back branches.) This is loosely based on a patch by KaiGai Kohei, heavily reworked by me.
This commit is contained in:
@@ -21,9 +21,8 @@
|
||||
extern Oid ExecRenameStmt(RenameStmt *stmt);
|
||||
|
||||
extern Oid ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
|
||||
extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
|
||||
extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
|
||||
ObjectAddresses *objsMoved);
|
||||
extern Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid);
|
||||
|
||||
extern Oid ExecAlterOwnerStmt(AlterOwnerStmt *stmt);
|
||||
extern void AlterObjectOwner_internal(Relation catalog, Oid objectId,
|
||||
|
@@ -19,7 +19,6 @@
|
||||
|
||||
extern Oid DefineCollation(List *names, List *parameters);
|
||||
extern Oid RenameCollation(List *name, const char *newname);
|
||||
extern Oid AlterCollationNamespace(List *name, const char *newschema);
|
||||
extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid);
|
||||
extern void IsThereCollationInNamespace(const char *collname, Oid newNspOid);
|
||||
|
||||
#endif /* COLLATIONCMDS_H */
|
||||
|
@@ -50,9 +50,8 @@ extern Oid RenameFunction(List *name, List *argtypes, const char *newname);
|
||||
extern Oid AlterFunction(AlterFunctionStmt *stmt);
|
||||
extern Oid CreateCast(CreateCastStmt *stmt);
|
||||
extern void DropCastById(Oid castOid);
|
||||
extern Oid AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
|
||||
const char *newschema);
|
||||
extern Oid AlterFunctionNamespace_oid(Oid procOid, Oid nspOid);
|
||||
extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
|
||||
oidvector proargtypes, Oid nspOid);
|
||||
extern void ExecuteDoStmt(DoStmt *stmt);
|
||||
extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
|
||||
|
||||
|
Reference in New Issue
Block a user