an efficient, validated, formatted Canadian postal code type
This type supports efficient, validated, formatted usage of Canadian postal codes. It provides sane ordering functionality through implementation of custom comparison operators.curl -s -S -L https://github.com/rlichtenwalter/pg_postal_code_ca/archive/master.zip > pg_postal_code_CA.zip unzip pg_postal_code_ca.zip (cd pg_postal_code_ca-master && make PG_CONFIG=<optional custom pg_config path>) (cd pg_postal_code_ca-master && make PG_CONFIG=<optional custom pg_config path> install) (cd ~postgres && sudo -u postgres psql -c 'CREATE EXTENSION pg_postal_code_ca;')
testuser=# SELECT 'h2e3f1'::canadian_postal_code; canadian_postal_code ---------------------- H2E 3F1 (1 row)testuser=# SELECT 'H2E 3F1'::canadian_postal_code; canadian_postal_code ---------------------- H2E 3F1 (1 row)
testuser=# SELECT 'A2CCF3'::canadian_postal_code; ERROR: invalid input format for candian_postal_code: 'A2CCF3' LINE 1: SELECT 'A2CCF3'::canadian_postal_code;