> On Jun 15, 2022, at 8:51 PM, Michael Paquier <mich...@paquier.xyz> wrote:
>
> I am not sure to see why this would be something users would actually
> use in prod. That means to pick up something else than what the
> server thinks is the best default AM but where somebody does not want
> to trust the default, while generating an error if specifying the
> default AM in the USING NOT clause.
Sorry for the lack of clarity. I do not suggest raising an error. If you say
"USING NOT foo", and foo is the default table access method, then you get the
same behavior as a "USING heap" would have gotten you, otherwise, you get the
same behavior as not providing any USING clause at all.
In future, we might want to create a list of fallback tams rather than just
hardcoding "heap" as the one and only fallback, but I haven't run into an
actual need for that. If you're wondering what "USING NOT heap" falls back to,
I think that could error, or it could just use heap anyway. Whatever. That's
why I'm still soliciting for comments at this phase rather than posting a patch.
> On top of that
> default_table_access_method is user-settable.
Yeah, but specifying a "USING foo" clause is also open to any user, so I don't
see why this matters. "USING NOT foo" is just shorthand for checking the
current default_table_access_method, and then either appending a "USING heap"
clause or appending no clause. Since the user can do this anyway, what's the
security implication in some syntactic sugar?
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company