Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f60be7

Browse files
committed
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
1 parentdc8a143 commit7f60be7

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

‎src/backend/commands/alter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
198198
break;
199199

200200
caseOBJECT_OPCLASS:
201-
AlterOpClassNamespace(stmt->object,stmt->objarg,stmt->newschema);
201+
AlterOpClassNamespace(stmt->object,stmt->addname,stmt->newschema);
202202
break;
203203

204204
caseOBJECT_OPFAMILY:
205-
AlterOpFamilyNamespace(stmt->object,stmt->objarg,stmt->newschema);
205+
AlterOpFamilyNamespace(stmt->object,stmt->addname,stmt->newschema);
206206
break;
207207

208208
caseOBJECT_SEQUENCE:

‎src/backend/commands/opclasscmds.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,16 +1993,13 @@ AlterOpClassOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
19931993
* ALTER OPERATOR CLASS any_name USING access_method SET SCHEMA name
19941994
*/
19951995
void
1996-
AlterOpClassNamespace(List*name,List*argam,constchar*newschema)
1996+
AlterOpClassNamespace(List*name,char*access_method,constchar*newschema)
19971997
{
19981998
OidamOid;
1999-
char*access_method=linitial(argam);
20001999
Relationrel;
20012000
Oidoid;
20022001
OidnspOid;
20032002

2004-
Assert(list_length(argam)==1);
2005-
20062003
amOid=get_am_oid(access_method, false);
20072004

20082005
rel=heap_open(OperatorClassRelationId,RowExclusiveLock);
@@ -2185,15 +2182,13 @@ get_am_oid(const char *amname, bool missing_ok)
21852182
* ALTER OPERATOR FAMILY any_name USING access_method SET SCHEMA name
21862183
*/
21872184
void
2188-
AlterOpFamilyNamespace(List*name,List*argam,constchar*newschema)
2185+
AlterOpFamilyNamespace(List*name,char*access_method,constchar*newschema)
21892186
{
21902187
OidamOid;
2191-
char*access_method=linitial(argam);
21922188
Relationrel;
21932189
OidnspOid;
21942190
Oidoid;
21952191

2196-
Assert(list_length(argam)==1);
21972192
amOid=get_am_oid(access_method, false);
21982193

21992194
rel=heap_open(OperatorFamilyRelationId,RowExclusiveLock);

‎src/backend/parser/gram.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6225,7 +6225,7 @@ AlterObjectSchemaStmt:
62256225
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
62266226
n->objectType = OBJECT_OPCLASS;
62276227
n->object =$4;
6228-
n->objarg =list_make1($6);
6228+
n->addname =$6;
62296229
n->newschema =$9;
62306230
$$ = (Node *)n;
62316231
}
@@ -6234,7 +6234,7 @@ AlterObjectSchemaStmt:
62346234
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
62356235
n->objectType = OBJECT_OPFAMILY;
62366236
n->object =$4;
6237-
n->objarg =list_make1($6);
6237+
n->addname =$6;
62386238
n->newschema =$9;
62396239
$$ = (Node *)n;
62406240
}

‎src/include/commands/defrem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ extern void RenameOpClass(List *name, const char *access_method, const char *new
101101
externvoidRenameOpFamily(List*name,constchar*access_method,constchar*newname);
102102
externvoidAlterOpClassOwner(List*name,constchar*access_method,OidnewOwnerId);
103103
externvoidAlterOpClassOwner_oid(OidopclassOid,OidnewOwnerId);
104-
externvoidAlterOpClassNamespace(List*name,List*argam,constchar*newschema);
104+
externvoidAlterOpClassNamespace(List*name,char*access_method,constchar*newschema);
105105
externvoidAlterOpFamilyOwner(List*name,constchar*access_method,OidnewOwnerId);
106106
externvoidAlterOpFamilyOwner_oid(OidopfamilyOid,OidnewOwnerId);
107107
externOidget_am_oid(constchar*amname,boolmissing_ok);
108-
externvoidAlterOpFamilyNamespace(List*name,List*argam,constchar*newschema);
108+
externvoidAlterOpFamilyNamespace(List*name,char*access_method,constchar*newschema);
109109

110110
/* commands/tsearchcmds.c */
111111
externvoidDefineTSParser(List*names,List*parameters);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp