From b9c9e61189fd1e868e8663efb9fb05b55af39521 Mon Sep 17 00:00:00 2001 From: Yorick de Wid Date: Sat, 5 Mar 2016 23:32:06 +0100 Subject: [PATCH] Create README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d1a8c2a --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# PostgreSQL-IBAN +PostgreSQL IBAN extension that can verify International Bank Account Numbers. +This ensures that only valid bank account numbers are stored. + +### Example +```sql +CREATE TABLE test_iban ( + id serial NOT NULL, + name character varying(32), + account iban, + CONSTRAINT test_iban_pkey PRIMARY KEY (id) +) + +-- Insert data +INSERT INTO test_iban (name, account) VALUES ('John', 'NL91ABNA0417164300'); -- Dutch IBAN format +INSERT INTO test_iban (name, account) VALUES ('Doe', 'DE89370400440532013000'); -- German IBAN format + +-- Invalid bank account +INSERT INTO test_iban (name, account) VALUES ('Dean', 'AZ22NABZ00000000137010001944'); + +``` + +Manually test input +```sql +SELECT iban_validate('KW81CBKU0000000000001234560101'); +-- Or cast +SELECT 'KZ86125KZT5004100100'::iban; +``` + +the `::iban` datatype can be cast to an text to perform string operations +```sql +SELECT 'KZ86125KZT5004100100'::iban::text; +```