Skip to content

an efficient, validated, formatted Canadian postal code type

License

Notifications You must be signed in to change notification settings

rlichtenwalter/pg_postal_code_ca

Repository files navigation

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;

About

an efficient, validated, formatted Canadian postal code type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published