CREATE EXTENSION IF NOT EXISTS salesforce_id; NOTICE: extension "salesforce_id" already exists, skipping CREATE EXTENSION IF NOT EXISTS pgtap; NOTICE: extension "pgtap" already exists, skipping SELECT '0012800000CXn0kAAD'::salesforce_id; salesforce_id -------------------- 0012800000CXn0kAAD (1 row) SELECT '0012800000CXmbXAAT'::salesforce_id; salesforce_id -------------------- 0012800000CXmbXAAT (1 row) SELECT '001p000000OoULiAAN'::salesforce_id; salesforce_id -------------------- 001p000000OoULiAAN (1 row) SELECT '000000000000000AAA'::salesforce_id; salesforce_id -------------------- 000000000000000AAA (1 row) SELECT 'AAAAAJJJJJPPPPP555'::salesforce_id; salesforce_id -------------------- AAAAAJJJJJPPPPP555 (1 row) SELECT 'zzzzzzzzzzzzzzzAAA'::salesforce_id; salesforce_id -------------------- zzzzzzzzzzzzzzzAAA (1 row) SELECT plan(1); plan ------ 1..1 (1 row) SELECT throws_ok( $$ SELECT 'zzzzzzzzzzzzzzzAA'::salesforce_id; $$, '22026', 'Invalid salesforce_id, should be 18 characters long, got 17 instead', 'We should get an error when length is not correct' ); throws_ok ---------------------------------------------------------- ok 1 - We should get an error when length is not correct (1 row)