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