I am trying to implement a domain to check for proper postal codes for Canada. I wrote the following but i get a constraint error. Can you please tell me where i may be wrong? i would really appreciate it.
CREATE DOMAIN can_postal_code varchar(6)
CONSTRAINT valid_postal_code
CHECK (VALUE ~ '^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]\d[ABCEGHJKLMNPRSTVWXYZ]\d$');