Rose::DB::Object::MakeMethods::Pg creates methods that deal with data types that are specific to the PostgreSQL database server. It inherits from Rose::Object::MakeMethods. See the Rose::Object::MakeMethods documentation to learn about the interface. The method types provided by this module are described below.

All method types defined by this module are designed to work with objects that are subclasses of (or otherwise conform to the interface of) Rose::DB::Object. In particular, the object is expected to have a db method that returns a Rose::DB-derived object. See the Rose::DB::Object documentation for more details.

Create a family methods for handling PostgreSQL's "CHKPASS" data type. This data type is not installed by default, but is included in the standard PostgreSQL source code distribution (in the "contrib" directory). From the README file for CHKPASS:

"Chkpass is a password type that is automatically checked and converted upon entry. It is stored encrypted. To compare, simply compare against a clear text password and the comparison function will encrypt it before comparing.

If you precede the string with a colon, the encryption and checking are skipped so that you can enter existing passwords into the field.

On output, a colon is prepended. This makes it possible to dump and reload passwords without re-encrypting them. If you want the password (encrypted) without the colon then use the raw() function. This allows you to use the type with things like Apache's Auth_PostgreSQL module."

This data type is very handy for storing encrypted values such as passwords while still retaining the ability to perform SELECTs and such using unencrypted values in comparisons. For example, the query

SELECT * FROM users WHERE password = 'foobar'

will actually find all the users whose passwords are "foobar", even though all the passwords are encrypted in the database.

The get/set method for the unencrypted value. (This method uses the default method name.) If called with no arguments, the unencrypted value is returned, if it is known. If not, undef is returned.

If passed an argument that begins with ":", it is assumed to be an encrypted value and is stored as such. Undef is returned, since it is not feasible to determine the unencrypted value based on the encrypted value.

If passed an argument that does not begin with ":", it is taken as the unencrypted value. The value is encrypted using Perl's crypt() function paired with a randomly selected salt, and the unencrypted value is returned.

The get/set method for the encrypted value. The method name will be formed by concatenating the default method name (above) and the value of the encrypted_suffix option.

If called with no arguments, the encrypted value is returned, if it is known. If not, undef is returned.

If passed an argument that begins with ":", it is assumed to be an encrypted value and is stored as such. The unencrypted value is set to undef, since it is not feasible to determine the unencrypted value based on the encrypted value. The encrypted value is returned.

If passed an argument that does not begin with ":", it is taken as the unencrypted value. The value is encrypted using Perl's crypt() function paired with a randomly selected salt, and the encrypted value is returned.

This method compares its argument to the unencrypted value and returns true if the two values are identical (string comparison), false if they are not, and undef if both the encrypted and unencrypted values are undefined.