Implementation of the type to store Social Security Numbers (SSNs) for PostgreSQL. Each SSN is normally represented as a nine digit number in a form AAA-BB-CCCC, where AAA is called the area number, BB - the is the group number, and CCCC - the serial number. Installation: make make install Usage: \i ssn.sql CREATE TABLE test(ssn ssn PRIMARY KEY); There are 2 formats accepted by the type: AAA-BB-CCCC, i.e: INSERT INTO test VALUES('123-45-6789'); or AAABBCCCC, i.e. INSERT INTO test VALUES('124659876'); The output is always represented using the format with dashes, i.e: 123-45-6789 124-65-9876 Internals: The type is stored as a 4 bytes integer.