Revision 14204
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
885 | 885 |
|
886 | 886 |
|
887 | 887 |
-- |
888 |
-- Name: check_constraint__disabled(check_constraint_def); Type: FUNCTION; Schema: util; Owner: -
|
|
888 |
-- Name: check_constraint(check_constraint_def, boolean); Type: FUNCTION; Schema: util; Owner: -
|
|
889 | 889 |
-- |
890 | 890 |
|
891 |
CREATE FUNCTION check_constraint__disabled(constraint_def check_constraint_def) RETURNS void
|
|
891 |
CREATE FUNCTION check_constraint(constraint_def check_constraint_def, enabled boolean DEFAULT true) RETURNS void
|
|
892 | 892 |
LANGUAGE sql |
893 | 893 |
AS $$ |
894 |
SELECT util.check_constraint_disable(constraint_def) -- auto-create |
|
894 |
-- auto-create |
|
895 |
SELECT CASE WHEN enabled THEN util.check_constraint_enable(constraint_def) |
|
896 |
ELSE util.check_constraint_disable(constraint_def) |
|
897 |
END |
|
895 | 898 |
$$; |
896 | 899 |
|
897 | 900 |
|
898 | 901 |
-- |
899 |
-- Name: FUNCTION check_constraint__disabled(constraint_def check_constraint_def); Type: COMMENT; Schema: util; Owner: -
|
|
902 |
-- Name: FUNCTION check_constraint(constraint_def check_constraint_def, enabled boolean); Type: COMMENT; Schema: util; Owner: -
|
|
900 | 903 |
-- |
901 | 904 |
|
902 |
COMMENT ON FUNCTION check_constraint__disabled(constraint_def check_constraint_def) IS ' |
|
903 |
creates a CHECK constraint which is initially disabled |
|
904 |
|
|
905 |
COMMENT ON FUNCTION check_constraint(constraint_def check_constraint_def, enabled boolean) IS ' |
|
905 | 906 |
idempotent |
906 | 907 |
'; |
907 | 908 |
|
Also available in: Unified diff
schemas/util.sql: check_constraint__disabled(): made disabled configurable (renaming func to check_constraint())