Go to file
Yorick de Wid b9c9e61189 Create README.md 2016-03-05 23:32:06 +01:00
.gitignore Remove unnecessary logic 2016-03-01 20:36:43 +01:00
Makefile Fully working IBAN extension 2016-03-05 23:17:38 +01:00
README.md Create README.md 2016-03-05 23:32:06 +01:00
iban--1.0.0.sql Binary conversions 2016-03-05 23:17:05 +01:00
iban.cc Fully working IBAN extension 2016-03-05 23:17:38 +01:00
iban.control Initial commit 2016-03-01 16:56:02 +01:00
specification.h Remove unnecessary logic 2016-03-01 20:36:43 +01:00
validate.h Remove unnecessary logic 2016-03-01 20:36:43 +01:00

README.md

PostgreSQL-IBAN

PostgreSQL IBAN extension that can verify International Bank Account Numbers. This ensures that only valid bank account numbers are stored.

Example

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

SELECT iban_validate('KW81CBKU0000000000001234560101');
-- Or cast
SELECT 'KZ86125KZT5004100100'::iban;

the ::iban datatype can be cast to an text to perform string operations

SELECT 'KZ86125KZT5004100100'::iban::text;