agora inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
rolconfig and datconfig
3+ messages / 3 participants
[nested] [flat]

* rolconfig and datconfig
@ 2025-02-13 08:11  Fabrice Chapuis <fabrice636861@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Fabrice Chapuis @ 2025-02-13 08:11 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi,

il we need to consult the options for a specific role, we can find that
information in the pg_roles table. But options for a database is not in
pg_database, there is no field datconfig. Is there a reason for that?

Regards,

Fabrice

postgres [591176]=# \d pg_roles
                          View "pg_catalog.pg_roles"
┌────────────────┬──────────────────────────┬───────────┬──────────┬─────────┐
│     Column     │           Type           │ Collation │ Nullable │
Default │
├────────────────┼──────────────────────────┼───────────┼──────────┼─────────┤
│ rolname        │ name                     │           │          │
 │
│ rolsuper       │ boolean                  │           │          │
 │
│ rolinherit     │ boolean                  │           │          │
 │
│ rolcreaterole  │ boolean                  │           │          │
 │
│ rolcreatedb    │ boolean                  │           │          │
 │
│ rolcanlogin    │ boolean                  │           │          │
 │
│ rolreplication │ boolean                  │           │          │
 │
│ rolconnlimit   │ integer                  │           │          │
 │
│ rolpassword    │ text                     │           │          │
 │
│ rolvaliduntil  │ timestamp with time zone │           │          │
 │
│ rolbypassrls   │ boolean                  │           │          │
 │
│ => rolconfig      │ text[]                   │ C         │          │
     │
│ oid            │ oid                      │           │          │
 │
└────────────────┴──────────────────────────┴───────────┴──────────┴─────────┘

postgres [591176]=# \d pg_database
                Table "pg_catalog.pg_database"
┌───────────────┬───────────┬───────────┬──────────┬─────────┐
│    Column     │   Type    │ Collation │ Nullable │ Default │
├───────────────┼───────────┼───────────┼──────────┼─────────┤
│ oid           │ oid       │           │ not null │         │
│ datname       │ name      │           │ not null │         │
│ datdba        │ oid       │           │ not null │         │
│ encoding      │ integer   │           │ not null │         │
│ datcollate    │ name      │           │ not null │         │
│ datctype      │ name      │           │ not null │         │
│ datistemplate │ boolean   │           │ not null │         │
│ datallowconn  │ boolean   │           │ not null │         │
│ datconnlimit  │ integer   │           │ not null │         │
│ datlastsysoid │ oid       │           │ not null │         │
│ datfrozenxid  │ xid       │           │ not null │         │
│ datminmxid    │ xid       │           │ not null │         │
│ dattablespace │ oid       │           │ not null │         │
│ datacl        │ aclitem[] │           │          │         │
└───────────────┴───────────┴───────────┴──────────┴─────────┘
Indexes:
    "pg_database_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_database_datname_index" UNIQUE CONSTRAINT, btree (datname),
tablespace "pg_global"
Tablespace: "pg_global"


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: rolconfig and datconfig
@ 2025-02-13 10:45  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Fabrice Chapuis <fabrice636861@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Laurenz Albe @ 2025-02-13 10:45 UTC (permalink / raw)
  To: Fabrice Chapuis <fabrice636861@gmail.com>; pgsql-admin@lists.postgresql.org

On Thu, 2025-02-13 at 09:11 +0100, Fabrice Chapuis wrote:
> il we need to consult the options for a specific role, we can find that
> information in the pg_roles table. But options for a database is not in
> pg_database, there is no field datconfig. Is there a reason for that?
> 
> postgres [591176]=# \d pg_roles
>                           View "pg_catalog.pg_roles"
> ┌────────────────┬──────────────────────────┬───────────┬──────────┬─────────┐
> │     Column     │           Type           │ Collation │ Nullable │ Default │
> ├────────────────┼──────────────────────────┼───────────┼──────────┼─────────┤
>   ...
> │ => rolconfig      │ text[]                   │ C         │          │         │
>   ...
> └────────────────┴──────────────────────────┴───────────┴──────────┴─────────┘

The reason is that "pg_roles" is not a table, but a view.
The table that stores the roles is "pg_authid", and that catalog doesn't
have a "rolconfig" column either.

The parameters set for roles and/or databases are stored in "pg_db_role_setting",
and the values in "pg_roles.rolconfig" are taken from there.

Look at "\d+ pg_roles" to see for yourself.

Yours,
Laurenz Albe

-- 

*E-Mail Disclaimer*
Der Inhalt dieser E-Mail ist ausschliesslich fuer den 
bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat 
dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte, 
dass jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder 
Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie, sich 
in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

*CONFIDENTIALITY NOTICE & DISCLAIMER
*This message and any attachment are 
confidential and may be privileged or otherwise protected from disclosure 
and solely for the use of the person(s) or entity to whom it is intended. 
If you have received this message in error and are not the intended 
recipient, please notify the sender immediately and delete this message and 
any attachment from your system. If you are not the intended recipient, be 
advised that any use of this message is prohibited and may be unlawful, and 
you must not copy this message or attachment or disclose the contents to 
any other person.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: rolconfig and datconfig
@ 2025-02-13 13:19  Álvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Fabrice Chapuis <fabrice636861@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Álvaro Herrera @ 2025-02-13 13:19 UTC (permalink / raw)
  To: Fabrice Chapuis <fabrice636861@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

Hello

On 2025-Feb-13, Fabrice Chapuis wrote:

> il we need to consult the options for a specific role, we can find that
> information in the pg_roles table. But options for a database is not in
> pg_database, there is no field datconfig. Is there a reason for that?

Yeah, options are stored separately to support having options that vary
per user and per database.  See \drds, especially under psql -E.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"No renuncies a nada. No te aferres a nada."





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-02-13 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-13 08:11 rolconfig and datconfig Fabrice Chapuis <fabrice636861@gmail.com>
2025-02-13 10:45 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-02-13 13:19 ` Álvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox