Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 1.13 KB

README.md

File metadata and controls

33 lines (28 loc) · 1.13 KB

pg_postal_code_ca

an efficient, validated, formatted Canadian postal code type

Description

This type supports efficient, validated, formatted usage of Canadian postal codes. It provides sane ordering functionality through implementation of custom comparison operators.

Installation

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;')

Usage

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;