in CloudNativePG version 1.22 and onwards, the default configuration disables the use of ALTER SYSTEM on new Postgres clusters. This decision is rooted in the recognition of potential risks associated with this command. To enable the use of ALTER SYSTEM, you can explicitly set .spec.postgresql.enableAlterSystem to true.
https://cloudnative-pg.io/documentation/1.22/postgresql_conf/#enabling-alter-system