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

Commit69cefb3

Browse files
committed
Avoid invalid array reference in transformAlterTableStmt().
Don't try to look at the attidentity field of system attributes,because they're not there in the TupleDescAttr array. Sometimesthis is harmless because we accidentally pick up a zero, butotherwise we'll report "no owned sequence found" from an attemptto alter a system attribute. (It seems possible that a SIGSEGVcould occur, too, though I've not seen it in testing.)It's not in this function's charter to complain that you can'talter a system column, so instead just hard-wire an assumptionthat system attributes aren't identities. I didn't bother witha regression test because the appearance of the bug is veryerratic.Per bug #17465 from Roman Zharkov. Back-patch to all supportedbranches. (There's not actually a live bug before v12, becausebefore that get_attidentity() did the right thing anyway.But for consistency I changed the test in the older branches too.)Discussion:https://postgr.es/m/17465-f2a554a6cb5740d3@postgresql.org
1 parenta6fc64b commit69cefb3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/parser/parse_utilcmd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3324,7 +3324,8 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
33243324
errmsg("column \"%s\" of relation \"%s\" does not exist",
33253325
cmd->name,RelationGetRelationName(rel))));
33263326

3327-
if (TupleDescAttr(tupdesc,attnum-1)->attidentity)
3327+
if (attnum>0&&
3328+
TupleDescAttr(tupdesc,attnum-1)->attidentity)
33283329
{
33293330
Oidseq_relid=getIdentitySequence(relid,attnum, false);
33303331
OidtypeOid=typenameTypeId(pstate,def->typeName);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp