Re: bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation

Поиск
Список
Период
Сортировка
От Chao Li
Тема Re: bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation
Дата
Msg-id CAEoWx2nEXYMm+UhXaPdBfG2yqMoRMHiujGMrye9mnP6_jP26cQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation  (jian he <jian.universality@gmail.com>)
Ответы Re: bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation
Список pgsql-hackers
Hi Jian,

On Mon, Sep 29, 2025 at 3:43 PM jian he <jian.universality@gmail.com> wrote:

please also check the attached patch.
The idea is that if both generation expression and type are being changed,
only call ATPostAlterTypeCleanup while the current pass is
AT_PASS_SET_EXPRESSION.

I think your implementation is similar to my previous dirty fix, the main idea is to postpone the cleanup to after AT_PASS_SET_EXPRESSION.

But I feel we don't need an extra loop to find tabs that have both ALTER TYPE and SET EXPRESSION, and do the if-else check, the logic is a bit difficult to understand.

I am attaching my version and please see if you like it. My version just records tabs to cleanup in an array, then runs the cleanup after the AT_PASS_SET_EXPRESSION pass.

A nit comment is:
```
@@ -15578,6 +15601,8 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode)
 
  free_object_addresses(objects);
 
+
+
```
Why add two newlines here? Seems a typo.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Вложения

В списке pgsql-hackers по дате отправления: