34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
--
|
|
-- Test VATIN extensions
|
|
--
|
|
CREATE EXTENSION vat;
|
|
-- Test valid conversions
|
|
SELECT 'ES40404040D'::VATIN,
|
|
'ES40404040-D'::VATIN,
|
|
' esx0523821l '::VATIN,
|
|
'ESM0243487d'::VATIN,
|
|
' ESb17616756 '::VATIN,
|
|
'ESb17385717'::VATIN,
|
|
'ESA08023780'::VATIN
|
|
;
|
|
vatin | vatin | vatin | vatin | vatin | vatin | vatin
|
|
-------------+-------------+-------------+-------------+-------------+-------------+-------------
|
|
ES40404040D | ES40404040D | ESX0523821L | ESM0243487D | ESB17616756 | ESB17385717 | ESA08023780
|
|
(1 row)
|
|
|
|
-- Test invalid checksums
|
|
SELECT 'ES40414040D'::VATIN;
|
|
ERROR: invalid input syntax for VAT number: "ES40414040D"
|
|
LINE 1: SELECT 'ES40414040D'::VATIN;
|
|
^
|
|
SELECT 'ESM0243487F'::VATIN;
|
|
ERROR: invalid input syntax for VAT number: "ESM0243487F"
|
|
LINE 1: SELECT 'ESM0243487F'::VATIN;
|
|
^
|
|
SELECT 'ESB17616757'::VATIN;
|
|
ERROR: invalid input syntax for VAT number: "ESB17616757"
|
|
LINE 1: SELECT 'ESB17616757'::VATIN;
|
|
^
|
|
-- Cleanup
|
|
DROP EXTENSION vat;
|