SELECT dps_validate(code), count(*) FROM ( VALUES
   ('1A'), ('1B'), ('1D'), ('1E'), ('1F'), ('1G'), ('1H'), ('1J'),
   ('1L'), ('1N'), ('1P'), ('1Q'), ('1R'), ('1S'), ('1T'), ('1U'), 
   ('1W'), ('1X'), ('1Y'), ('1Z'), ('2A'), ('2B'), ('2D'), ('2E'), 
   ('2F'), ('2G'), ('2H'), ('2J'), ('2L'), ('2N'), ('2P'), ('2Q'), 
   ('2R'), ('2S'), ('2T'), ('2U'), ('2W'), ('2X'), ('2Y'), ('2Z'), 
   ('3A'), ('3B'), ('3D'), ('3E'), ('3F'), ('3G'), ('3H'), ('3J'), 
   ('3L'), ('3N'), ('3P'), ('3Q'), ('3R'), ('3S'), ('3T'), ('3U'), 
   ('3W'), ('3X'), ('3Y'), ('3Z'), ('4A'), ('4B'), ('4D'), ('4E'), 
   ('4F'), ('4G'), ('4H'), ('4J'), ('4L'), ('4N'), ('4P'), ('4Q'), 
   ('4R'), ('4S'), ('4T'), ('4U'), ('4W'), ('4X'), ('4Y'), ('4Z'), 
   ('5A'), ('5B'), ('5D'), ('5E'), ('5F'), ('5G'), ('5H'), ('5J'), 
   ('5L'), ('5N'), ('5P'), ('5Q'), ('5R'), ('5S'), ('5T'), ('5U'), 
   ('5W'), ('5X'), ('5Y'), ('5Z'), ('6A'), ('6B'), ('6D'), ('6E'), 
   ('6F'), ('6G'), ('6H'), ('6J'), ('6L'), ('6N'), ('6P'), ('6Q'), 
   ('6R'), ('6S'), ('6T'), ('6U'), ('6W'), ('6X'), ('6Y'), ('6Z'), 
   ('7A'), ('7B'), ('7D'), ('7E'), ('7F'), ('7G'), ('7H'), ('7J'), 
   ('7L'), ('7N'), ('7P'), ('7Q'), ('7R'), ('7S'), ('7T'), ('7U'), 
   ('7W'), ('7X'), ('7Y'), ('7Z'), ('8A'), ('8B'), ('8D'), ('8E'), 
   ('8F'), ('8G'), ('8H'), ('8J'), ('8L'), ('8N'), ('8P'), ('8Q'), 
   ('8R'), ('8S'), ('8T'), ('8U'), ('8W'), ('8X'), ('8Y'), ('8Z'), 
   ('9A'), ('9B'), ('9D'), ('9E'), ('9F'), ('9G'), ('9H'), ('9J'), 
   ('9L'), ('9N'), ('9P'), ('9Q'), ('9R'), ('9S'), ('9T'), ('9U'), 
   ('9W'), ('9X'), ('9Y'), ('9Z'), ('1a'), ('1b'), ('1d'), ('1e'), 
   ('1f'), ('1g'), ('1h'), ('1j'), ('1l'), ('1n'), ('1p'), ('1q'), 
   ('1r'), ('1s'), ('1t'), ('1u'), ('1w'), ('1x'), ('1y'), ('1z'), 
   ('2a'), ('2b'), ('2d'), ('2e'), ('2f'), ('2g'), ('2h'), ('2j'), 
   ('2l'), ('2n'), ('2p'), ('2q'), ('2r'), ('2s'), ('2t'), ('2u'), 
   ('2w'), ('2x'), ('2y'), ('2z'), ('3a'), ('3b'), ('3d'), ('3e'), 
   ('3f'), ('3g'), ('3h'), ('3j'), ('3l'), ('3n'), ('3p'), ('3q'), 
   ('3r'), ('3s'), ('3t'), ('3u'), ('3w'), ('3x'), ('3y'), ('3z'), 
   ('4a'), ('4b'), ('4d'), ('4e'), ('4f'), ('4g'), ('4h'), ('4j'), 
   ('4l'), ('4n'), ('4p'), ('4q'), ('4r'), ('4s'), ('4t'), ('4u'), 
   ('4w'), ('4x'), ('4y'), ('4z'), ('5a'), ('5b'), ('5d'), ('5e'), 
   ('5f'), ('5g'), ('5h'), ('5j'), ('5l'), ('5n'), ('5p'), ('5q'), 
   ('5r'), ('5s'), ('5t'), ('5u'), ('5w'), ('5x'), ('5y'), ('5z'), 
   ('6a'), ('6b'), ('6d'), ('6e'), ('6f'), ('6g'), ('6h'), ('6j'), 
   ('6l'), ('6n'), ('6p'), ('6q'), ('6r'), ('6s'), ('6t'), ('6u'), 
   ('6w'), ('6x'), ('6y'), ('6z'), ('7a'), ('7b'), ('7d'), ('7e'), 
   ('7f'), ('7g'), ('7h'), ('7j'), ('7l'), ('7n'), ('7p'), ('7q'), 
   ('7r'), ('7s'), ('7t'), ('7u'), ('7w'), ('7x'), ('7y'), ('7z'), 
   ('8a'), ('8b'), ('8d'), ('8e'), ('8f'), ('8g'), ('8h'), ('8j'), 
   ('8l'), ('8n'), ('8p'), ('8q'), ('8r'), ('8s'), ('8t'), ('8u'), 
   ('8w'), ('8x'), ('8y'), ('8z'), ('9a'), ('9b'), ('9d'), ('9e'), 
   ('9f'), ('9g'), ('9h'), ('9j'), ('9l'), ('9n'), ('9p'), ('9q'), 
   ('9r'), ('9s'), ('9t'), ('9u'), ('9w'), ('9x'), ('9y'), ('9z')
) tmp (code)
GROUP BY dps_validate(code);


SELECT dps_validate(code), count(*) FROM ( VALUES
   ('1C'), ('1I'), ('1K'), ('1M'), ('1O'), ('1V'),
   ('2C'), ('2I'), ('2K'), ('2M'), ('2O'), ('2V'),
   ('3C'), ('3I'), ('3K'), ('3M'), ('3O'), ('3V'),
   ('4C'), ('4I'), ('4K'), ('4M'), ('4O'), ('4V'),
   ('5C'), ('5I'), ('5K'), ('5M'), ('5O'), ('5V'),
   ('6C'), ('6I'), ('6K'), ('6M'), ('6O'), ('6V'),
   ('7C'), ('7I'), ('7K'), ('7M'), ('7O'), ('7V'),
   ('8C'), ('8I'), ('8K'), ('8M'), ('8O'), ('8V'),
   ('9C'), ('9I'), ('9K'), ('9M'), ('9O'), ('9V'),
   ('1c'), ('1i'), ('1k'), ('1m'), ('1o'), ('1v'),
   ('2c'), ('2i'), ('2k'), ('2m'), ('2o'), ('2v'),
   ('3c'), ('3i'), ('3k'), ('3m'), ('3o'), ('3v'),
   ('4c'), ('4i'), ('4k'), ('4m'), ('4o'), ('4v'),
   ('5c'), ('5i'), ('5k'), ('5m'), ('5o'), ('5v'),
   ('6c'), ('6i'), ('6k'), ('6m'), ('6o'), ('6v'),
   ('7c'), ('7i'), ('7k'), ('7m'), ('7o'), ('7v'),
   ('8c'), ('8i'), ('8k'), ('8m'), ('8o'), ('8v'),
   ('9c'), ('9i'), ('9k'), ('9m'), ('9o'), ('9v')
) tmp (code)
GROUP BY dps_validate(code);


SELECT dps_validate(code), count(*) FROM ( VALUES
   ('0A'), ('0B'), ('0C'), ('0D'), ('0E'), ('0F'), ('0G'), ('0H'),
   ('0I'), ('0J'), ('0K'), ('0L'), ('0M'), ('0N'), ('0O'), ('0P'),
   ('0Q'), ('0R'), ('0S'), ('0T'), ('0U'), ('0V'), ('0W'), ('0X'),
   ('0Y'), ('0Z'), ('0a'), ('0b'), ('0c'), ('0d'), ('0e'), ('0f'),
   ('0g'), ('0h'), ('0i'), ('0j'), ('0k'), ('0l'), ('0m'), ('0n'),
   ('0o'), ('0p'), ('0q'), ('0r'), ('0s'), ('0t'), ('0u'), ('0v'),
   ('0w'), ('0x'), ('0y'), ('0z')
) tmp (code)
GROUP BY dps_validate(code);

SELECT dps_validate(code), count(*) FROM ( VALUES
   ('0'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'),
   ('9'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'),
   ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'),
   ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'),
   ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'),
   ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'),
   ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), (' ')
) tmp (code)
GROUP BY dps_validate(code);


SELECT code::dps FROM ( VALUES
   ('1z'), ('4w'), ('3n'), ('4h'), ('7b'), ('1t'), ('1g'), ('1D'), 
   ('3S'), ('4J'), ('9Y'), ('7e'), ('6G'), ('6n'), ('5Y'), ('5H'), 
   ('8u'), ('3q'), ('3s'), ('1n'), ('2N'), ('4U'), ('3E'), ('2y'), 
   ('7R'), ('1y'), ('8x'), ('5s'), ('3h'), ('1d'), ('4D'), ('7H'), 
   ('1R'), ('5x'), ('7u'), ('1x'), ('8T'), ('5u'), ('3a'), ('8J'), 
   ('9b'), ('8U'), ('8g'), ('4E'), ('2a'), ('7F'), ('2T'), ('8W'), 
   ('8h'), ('5P'), ('4B'), ('3z'), ('3B'), ('7Z'), ('9G'), ('7L'), 
   ('9D'), ('5z'), ('5T'), ('5l'), ('9s'), ('4W'), ('7y'), ('7h'), 
   ('4a'), ('1U'), ('9T'), ('9L'), ('1L'), ('7r'), ('9f'), ('6H'), 
   ('7t'), ('4P'), ('1T'), ('6Y'), ('1Y'), ('8X'), ('4b'), ('1l'), 
   ('8l'), ('6L'), ('1E'), ('9H'), ('4Y'), ('1B'), ('3t'), ('2Y'), 
   ('6r'), ('3l'), ('8a'), ('5w'), ('2L'), ('7E'), ('5y'), ('5Q'), 
   ('7d'), ('2X'), ('5r'), ('2r'), ('6Z'), ('4g'), ('8A'), ('9F'), 
   ('6X'), ('9X'), ('1w'), ('1X'), ('6l'), ('3A'), ('6x'), ('6T'), 
   ('4f'), ('3y'), ('3e'), ('7P'), ('8P'), ('5g'), ('3L'), ('8D'), 
   ('6w'), ('7a'), ('2J'), ('5J'), ('5U'), ('1F'), ('6P'), ('9u'), 
   ('8f'), ('7D'), ('4A'), ('1j'), ('7l'), ('8r'), ('7Q'), ('1G'), 
   ('9n'), ('8y'), ('8z'), ('3D'), ('2e'), ('7S'), ('5F'), ('1u'), 
   ('2F'), ('3W'), ('8S'), ('5D'), ('2W'), ('2l'), ('3u'), ('6u'), 
   ('6q'), ('5R'), ('4H'), ('7G'), ('7z'), ('8F'), ('7B'), ('8q'), 
   ('2H'), ('6D'), ('8Y'), ('2t'), ('1s'), ('4j'), ('5A'), ('3G'), 
   ('9h'), ('5W'), ('6j'), ('7s'), ('2U'), ('2f'), ('9d'), ('8E'), 
   ('7Y'), ('9N'), ('4Q'), ('5E'), ('2w'), ('8d'), ('6F'), ('9E'), 
   ('5B'), ('9q'), ('1r'), ('6a'), ('7j'), ('5e'), ('3b'), ('2D'), 
   ('3X'), ('3p'), ('7p'), ('8G'), ('5N'), ('2h'), ('5L'), ('2n'), 
   ('3x'), ('1S'), ('1N'), ('5d'), ('7J'), ('1A'), ('8w'), ('6S'), 
   ('4N'), ('2Q'), ('9P'), ('8R'), ('5Z'), ('5h'), ('2E'), ('6B'), 
   ('6W'), ('7q'), ('5X'), ('5f'), ('8L'), ('8p'), ('1J'), ('5j'), 
   ('9U'), ('2u'), ('1e'), ('1q'), ('1a'), ('9e'), ('2b'), ('4e'), 
   ('4t'), ('2s'), ('7w'), ('6h'), ('4s'), ('3P'), ('2G'), ('2S'), 
   ('9z'), ('6U'), ('5b'), ('2q'), ('6N'), ('7f'), ('6e'), ('6A'), 
   ('2z'), ('4F'), ('6J'), ('9Q'), ('4q'), ('8s'), ('4n'), ('7W'), 
   ('9R'), ('9l'), ('8t'), ('6t'), ('4S'), ('3R'), ('9p'), ('3w'), 
   ('6g'), ('9J'), ('8n'), ('9x'), ('9B'), ('5q'), ('8j'), ('2g'), 
   ('3f'), ('8e'), ('3Q'), ('4T'), ('4G'), ('8Z'), ('3Y'), ('3g'), 
   ('4Z'), ('4u'), ('2x'), ('2Z'), ('4L'), ('7n'), ('1Q'), ('4z'), 
   ('9S'), ('9a'), ('9Z'), ('5G'), ('9w'), ('9r'), ('6p'), ('1W'), 
   ('1p'), ('9j'), ('6z'), ('6R'), ('1f'), ('4X'), ('3T'), ('3J'), 
   ('3U'), ('7g'), ('4p'), ('6f'), ('6d'), ('2d'), ('8B'), ('7T'), 
   ('2p'), ('2P'), ('1Z'), ('3Z'), ('5S'), ('2A'), ('4y'), ('9t'), 
   ('4x'), ('6Q'), ('3r'), ('8b'), ('5n'), ('6s'), ('8N'), ('2j'), 
   ('4l'), ('1b'), ('3F'), ('9g'), ('3j'), ('2B'), ('5a'), ('9y'), 
   ('9W'), ('4d'), ('5p'), ('1H'), ('6b'), ('7A'), ('7x'), ('5t'), 
   ('7X'), ('4r'), ('7N'), ('8Q'), ('2R'), ('1h'), ('9A'), ('4R'), 
   ('3H'), ('1P'), ('3d'), ('6y'), ('7U'), ('8H'), ('3N'), ('6E')
) tmp (code)
ORDER BY code::dps ASC;


SELECT dps_validate(code), count(*) FROM ( VALUES
   ('1A1'),
   ('1A '),
   ('1A.'),
   (' 1A'),
   ('1 A'),
   (' 1 A'),
   ('1 A '),
   ('1/A'),
   ('A-1'),
   ('11'),
   ('AA'),
   ('A1'),
   ('A0'),
   ('C0'),
   ('C1'),
   ('C0'),
   ('10'),
   ('11'),
   (NULL)
) tmp (code)
GROUP BY dps_validate(code);
