Amit Kapila <amit.kapila16@gmail.com> writes:
> In above scenario, I think you are expecting it should use
> /data2/postgresql.auto.conf and that is what you have mentioned
> up-thread. The way to handle it by server is just to forbid setting
> this parameter
> by Alter System or the user himself should not perform such an action.
> Here if we want user to be careful of performing such an action, then may
> be it's better to have such an indication in ALTER SYSTEM documentation.
I think it's clearly *necessary* to forbid setting data_directory in
postgresql.auto.conf. The file is defined to be found in the data
directory, so any such setting is circular logic by definition;
no good can come of not rejecting it.
We already have a GUC flag bit about disallowing certain variables
in the config file (though I don't remember if it's enforced or
just advisory). It seems to me that we'd better invent one for
disallowing in ALTER SYSTEM, as well.
regards, tom lane