Created
August 30, 2012 16:26
-
-
Save vadviktor/3532358 to your computer and use it in GitHub Desktop.
Postgresql domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DOMAIN color_hexa AS character varying(7) DEFAULT NULL::character varying CONSTRAINT color_hexa_check CHECK (((VALUE)::text ~ '^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?'::text)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DOMAIN e_mail_address AS text CONSTRAINT e_mail_address_check CHECK ((VALUE ~ '^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+[.]{1}([a-zA-Z]{2,4})$'::text)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DOMAIN sha1_hexa_40 AS character(40) CONSTRAINT sha1_hexa_40_check CHECK ((VALUE ~* ('[a-f,0-9]{40}'::character(40))::text)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment