USER_CLUSTERS(5)

πŸ’– USER_CLUSTERS(5) πŸ’–

okay bestie, so this is a section 5 manual page β€” that's the "file formats and conventions" girlies β€” and it's part of the Debian PostgreSQL infrastructure. so you know it's giving real-deal system config energy. sit down, grab a strawberry, we're mapping users to clusters πŸ’…


✨ NAME ✨

user_clusters β€” the file that links users to PostgreSQL clusters πŸ¦‹


🌸 DESCRIPTION 🌸

so like. the file /etc/postgresql-common/user_clusters maps users against the database clusters they'll connect to by default. that's its whole thing. that's its moment. iconic behavior honestly.

but β€” and this is important β€” every single user can override these settings in ~/.postgresqlrc. so the file is more of a vibe suggestion than a vibe mandate, iykyk. 😌

when scanning this file, the first matching line will be used. not the last, not the best, not the prettiest β€” the first. so it is a really good idea to provide a default explicitly, with a final line where both user and group are set to *. put it last. periodt.

and if there is no default? if you just. didn't bother? the implicit default is:

  • connect to the cluster listening on port 5432
  • connect to the database matching the user's login name

so like, it'll work, but it's giving "I forgot to do the assignment and I'm improvising." do the assignment. πŸŽ€


πŸŽ€ FORMAT πŸŽ€

comments are introduced by the character #. comments may follow data on a line β€” the first comment character terminates the data. leading whitespace and blank lines are ignored, so go ahead and indent, she doesn't care, she's unbothered, she's thriving. πŸ’…

each uncommented, non-blank line must describe a user, a group, or the default (where both user and group are set to *).

fields must be given in the following order, separated by white space:

  • USER β€” the login id of the Unix user to whom this line applies. the wildcard character * means any user. ⭐
  • GROUP β€” the group name of the Unix group to which this line applies. the wildcard character * means any group. ⭐
  • VERSION β€” the major PostgreSQL version of the cluster to connect to.
  • CLUSTER β€” the name of a cluster to connect to. a remote cluster is specified with host:port. if port is empty, it defaults to 5432.
  • DATABASE β€” within the cluster, the database to which the user will connect by default if he does not specify a database on the command line. if this is *, the default database will be the one named by the user's login id. πŸ‘‘

πŸ’œ NOTES πŸ’œ

since the first matching line is used, the default line must come last. bestie. I'm serious. put the default. at the bottom. πŸ”₯

fr fr, this is the one thing everyone gets wrong and then they're in the group chat like "why is my cluster wrong" and it's because the default was on line 2. 😭

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the page!! mwah πŸ’– this one's from the Debian era, dated Feburary 2005 (yes, that's how it's spelled in the source, and yes, we're preserving it, no cap β€” every detail stays, that's the rule 🫢). stay slay, go read postgresqlrc(5) next. bye bestie!! πŸŽ€βœ¨