pg_luhn

This Release
pg_luhn 0.0.1
Date
Status
Stable
Abstract
Luhn algorithm implementation for Postgres
Description
Check a number using the Luhn formula
Released By
daamien
License
PostgreSQL
Resources
Special Files
Tags

Extensions

anon 0.0.1
Luhn algorithm implementation for Postgres

Documentation

LICENSE
The PostgreSQL License

README

pg_luhn

A pure SQL implementation of the Luhn Algorithm

Example

SELECT luhn_verify(5432);
 luhn_verify
-------------
 f
(1 row)

SELECT luhn_verify(5439);
 luhn_verify
-------------
 t
(1 row)


postgres=# SELECT luhn_generate(543);
 luhn_generate
---------------
           5439

Install

make
make install

Once the extension is installed on the server, you can create it inside the database.

CREATE EXTENSION pg_luhn;

Credits

This extension is based on the work of Craig Ringer published on the PostgreSQL Wiki