Role::Pg::Roles is a Moose role for accessing and manipulating roles (users and groups) in PostgreSQL.
While most of my development time is spent on a sales order / product management system using Djet, I'd like to blog about some of the modules I wrote so support this.

This month, the time has come to Role::Pg::Roles.


User management is conceptually very simple. You have some users who are members of some specific groups. You log in as a user, and presto you have access to the things you need to acess. Things become a increasingly harder when you want to add the posibilities you'd also expect, such as secure password, groups as members of groups, and so on. Still easy per se, just code you want other people to maintain.

PostgreSQL can do all what's needed to handle this, and has had this possibility for years. So why not just interface to their solution? Role::Pg::Roles does just that.

Roles are not part of any SQL standard, so DBD::Pg doesn't know about them. You can do the work yourself, or you can use this module.

What does it do?

From PostgreSQL's point of view, a user and a group is basically the same. So both are created and deleted in the same way. The main differences are that groups have other roles as members, and users have passwords. This is a very easy way to see things and makes for a clean interface.

Methods are basically split into these groups




As always, enhancements, better tests, and so on will be very welcomed. The git repo is here.


Fields in bold are mandatory
Email Address