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

Commit7a3977c

Browse files
committed
Fix a couple of oversights in new ALTER TABLE code that broke
ALTER SET STATISTICS for functional indexes.
1 parentc00b309 commit7a3977c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.106 2004/05/0800:34:49 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.107 2004/05/0822:46:29 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -112,6 +112,7 @@ typedef struct AlteredTableInfo
112112
{
113113
/* Information saved before any work commences: */
114114
Oidrelid;/* Relation to work on */
115+
charrelkind;/* Its relkind */
115116
TupleDescoldDesc;/* Pre-modification tuple descriptor */
116117
/* Information saved by Phase 1 for Phase 2: */
117118
List*subcmds[AT_NUM_PASSES];/* Lists of AlterTableCmd */
@@ -2011,9 +2012,10 @@ ATRewriteCatalogs(List **wqueue)
20112012
{
20122013
AlteredTableInfo*tab= (AlteredTableInfo*)lfirst(ltab);
20132014

2014-
if (tab->subcmds[AT_PASS_ADD_COL]||
2015-
tab->subcmds[AT_PASS_ALTER_TYPE]||
2016-
tab->subcmds[AT_PASS_COL_ATTRS])
2015+
if (tab->relkind==RELKIND_RELATION&&
2016+
(tab->subcmds[AT_PASS_ADD_COL]||
2017+
tab->subcmds[AT_PASS_ALTER_TYPE]||
2018+
tab->subcmds[AT_PASS_COL_ATTRS]))
20172019
{
20182020
AlterTableCreateToastTable(tab->relid, true);
20192021
}
@@ -2192,7 +2194,7 @@ ATRewriteTables(List **wqueue)
21922194
*/
21932195
reindex_relation(tab->relid, false);
21942196
}
2195-
else
2197+
elseif (tab->constraints!=NIL)
21962198
{
21972199
/*
21982200
* Test the current data within the table against new constraints
@@ -2486,6 +2488,7 @@ ATGetQueueEntry(List **wqueue, Relation rel)
24862488
*/
24872489
tab= (AlteredTableInfo*)palloc0(sizeof(AlteredTableInfo));
24882490
tab->relid=relid;
2491+
tab->relkind=rel->rd_rel->relkind;
24892492
tab->oldDesc=CreateTupleDescCopy(RelationGetDescr(rel));
24902493

24912494
*wqueue=lappend(*wqueue,tab);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp