yorickdewid / PostgreSQL-IBAN

PostgreSQL IBAN extension that can verify International Bank Account Numbers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C/C++ CI

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 (
  name text,
  account iban
);

--
-- Insert data
--

-- Dutch IBAN format
INSERT INTO test_iban (name, account) VALUES ('John', 'NL91ABNA0417164300');
-- German IBAN format
INSERT INTO test_iban (name, account) VALUES ('Doe', 'DE89370400440532013000');

-- Invalid data
INSERT INTO test_iban (name, account) VALUES ('Dean', 'AZ22NABZ00000000137010001944');

--
-- Show output
--

SELECT * FROM test_iban;

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;

Build

Make sure PostgreSQL development tools are installed (check pg_config).

On Debian based systems:

sudo apt install postgresql-server-dev-all
git clone https://github.com/yorickdewid/PostgreSQL-IBAN
cd PostgreSQL-IBAN
sudo make install

Login to the database and load the extension

CREATE EXTENSION iban;

About

PostgreSQL IBAN extension that can verify International Bank Account Numbers

License:GNU General Public License v3.0


Languages

Language:C++ 93.8%Language:Shell 4.5%Language:Makefile 1.7%