Re: ALTER TABLE SET ACCESS METHOD on partitioned tables

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Дата
Msg-id ZepxmAvTNYfptrQi@pryzbyj2023
обсуждение исходный текст
Ответ на Re: ALTER TABLE SET ACCESS METHOD on partitioned tables  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: ALTER TABLE SET ACCESS METHOD on partitioned tables  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Mon, Mar 04, 2024 at 05:46:56PM +0900, Michael Paquier wrote:
> > Since InvalidOid is already taken, I guess you might need to introduce a
> > boolean flag, like set_relam, indicating that the statement has an
> > ACCESS METHOD clause.
> 
> Yes, I don't see an alternative.  The default needs a different field
> to be tracked down to the execution.

The data structure you used (defaultAccessMethod) allows this, which
is intended to be prohibited:

postgres=# ALTER TABLE a SET access method default, SET access method default;
ALTER TABLE

As you wrote it, you pass the "defaultAccessMethod" bool to
ATExecSetAccessMethodNoStorage(), which seems odd.  Why not just pass
the target amoid as newAccessMethod ?

When I fooled with this on my side, I called it "chgAccessMethod" to
follow "chgPersistence".  I think "is default" isn't the right data
structure.

Attached a relative patch with my version.

Also: I just realized that instead of adding a bool, we could test
(tab->rewrite & AT_REWRITE_ACCESS_METHOD) != 0

+-- Default and AM set in in clause are the same, relam should be set.

in in?

-- 
Justin

Вложения

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

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Patch: Add parse_type Function
Следующее
От: David Rowley
Дата:
Сообщение: Re: Invalid query generated by postgres_fdw with UNION ALL and ORDER BY