Thread: Protected custom configuration option

Protected custom configuration option

From
Kouber Saparev
Date:
Hello,

I am looking for a way to define custom configuration option that will
only be accessible to roles with the "pg_read_all_settings" privilege.

I see such variables defined with the GUC_SUPERUSER_ONLY flag within
src/backend/utils/misc/guc.c:

{"ssl_ecdh_curve", PGC_SIGHUP, CONN_AUTH_SSL,
  gettext_noop("Sets the curve to use for ECDH."),
  NULL,
  GUC_SUPERUSER_ONLY
},
&SSLECDHCurve,

Is it possible to have a custom setting defined with this flag and
how? Only through an extension written in C, maybe?

What I need is something like:

kouber=> show redis.pass;
ERROR:  must be superuser or a member of pg_read_all_settings to
examine "redis.pass"

Cheers,
--
Kouber