@@ -3175,19 +3175,23 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
3175
3175
case AT_SetLogged :/* SET LOGGED */
3176
3176
ATSimplePermissions (rel ,ATT_TABLE );
3177
3177
tab -> chgPersistence = ATPrepChangePersistence (rel , true);
3178
- tab -> newrelpersistence = RELPERSISTENCE_PERMANENT ;
3179
- /* force rewrite if necessary */
3178
+ /* force rewrite if necessary; see comment in ATRewriteTables */
3180
3179
if (tab -> chgPersistence )
3180
+ {
3181
3181
tab -> rewrite = true;
3182
+ tab -> newrelpersistence = RELPERSISTENCE_PERMANENT ;
3183
+ }
3182
3184
pass = AT_PASS_MISC ;
3183
3185
break ;
3184
3186
case AT_SetUnLogged :/* SET UNLOGGED */
3185
3187
ATSimplePermissions (rel ,ATT_TABLE );
3186
3188
tab -> chgPersistence = ATPrepChangePersistence (rel , false);
3187
- tab -> newrelpersistence = RELPERSISTENCE_UNLOGGED ;
3188
- /* force rewrite if necessary */
3189
+ /* force rewrite if necessary; see comment in ATRewriteTables */
3189
3190
if (tab -> chgPersistence )
3191
+ {
3190
3192
tab -> rewrite = true;
3193
+ tab -> newrelpersistence = RELPERSISTENCE_UNLOGGED ;
3194
+ }
3191
3195
pass = AT_PASS_MISC ;
3192
3196
break ;
3193
3197
case AT_AddOids :/* SET WITH OIDS */