mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Fix crash in ALTER OPERATOR CLASS/FAMILY .. SET SCHEMA.
In the previous coding, the parser emitted a List containing a C string, which is no good, because copyObject() can't handle it. Dimitri Fontaine
This commit is contained in:
parent
dc8a14311a
commit
7f60be72b0
@ -198,11 +198,11 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
|
||||
break;
|
||||
|
||||
case OBJECT_OPCLASS:
|
||||
AlterOpClassNamespace(stmt->object, stmt->objarg, stmt->newschema);
|
||||
AlterOpClassNamespace(stmt->object, stmt->addname, stmt->newschema);
|
||||
break;
|
||||
|
||||
case OBJECT_OPFAMILY:
|
||||
AlterOpFamilyNamespace(stmt->object, stmt->objarg, stmt->newschema);
|
||||
AlterOpFamilyNamespace(stmt->object, stmt->addname, stmt->newschema);
|
||||
break;
|
||||
|
||||
case OBJECT_SEQUENCE:
|
||||
|
@ -1993,16 +1993,13 @@ AlterOpClassOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
|
||||
* ALTER OPERATOR CLASS any_name USING access_method SET SCHEMA name
|
||||
*/
|
||||
void
|
||||
AlterOpClassNamespace(List *name, List *argam, const char *newschema)
|
||||
AlterOpClassNamespace(List *name, char *access_method, const char *newschema)
|
||||
{
|
||||
Oid amOid;
|
||||
char *access_method = linitial(argam);
|
||||
Relation rel;
|
||||
Oid oid;
|
||||
Oid nspOid;
|
||||
|
||||
Assert(list_length(argam) == 1);
|
||||
|
||||
amOid = get_am_oid(access_method, false);
|
||||
|
||||
rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
|
||||
@ -2185,15 +2182,13 @@ get_am_oid(const char *amname, bool missing_ok)
|
||||
* ALTER OPERATOR FAMILY any_name USING access_method SET SCHEMA name
|
||||
*/
|
||||
void
|
||||
AlterOpFamilyNamespace(List *name, List *argam, const char *newschema)
|
||||
AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema)
|
||||
{
|
||||
Oid amOid;
|
||||
char *access_method = linitial(argam);
|
||||
Relation rel;
|
||||
Oid nspOid;
|
||||
Oid oid;
|
||||
|
||||
Assert(list_length(argam) == 1);
|
||||
amOid = get_am_oid(access_method, false);
|
||||
|
||||
rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
|
||||
|
@ -6225,7 +6225,7 @@ AlterObjectSchemaStmt:
|
||||
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
||||
n->objectType = OBJECT_OPCLASS;
|
||||
n->object = $4;
|
||||
n->objarg = list_make1($6);
|
||||
n->addname = $6;
|
||||
n->newschema = $9;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
@ -6234,7 +6234,7 @@ AlterObjectSchemaStmt:
|
||||
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
|
||||
n->objectType = OBJECT_OPFAMILY;
|
||||
n->object = $4;
|
||||
n->objarg = list_make1($6);
|
||||
n->addname = $6;
|
||||
n->newschema = $9;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ extern void RenameOpClass(List *name, const char *access_method, const char *new
|
||||
extern void RenameOpFamily(List *name, const char *access_method, const char *newname);
|
||||
extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId);
|
||||
extern void AlterOpClassOwner_oid(Oid opclassOid, Oid newOwnerId);
|
||||
extern void AlterOpClassNamespace(List *name, List *argam, const char *newschema);
|
||||
extern void AlterOpClassNamespace(List *name, char *access_method, const char *newschema);
|
||||
extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId);
|
||||
extern void AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId);
|
||||
extern Oid get_am_oid(const char *amname, bool missing_ok);
|
||||
extern void AlterOpFamilyNamespace(List *name, List *argam, const char *newschema);
|
||||
extern void AlterOpFamilyNamespace(List *name, char *access_method, const char *newschema);
|
||||
|
||||
/* commands/tsearchcmds.c */
|
||||
extern void DefineTSParser(List *names, List *parameters);
|
||||
|
Loading…
Reference in New Issue
Block a user