Revision 14221
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
2935 | 2935 |
|
2936 | 2936 |
|
2937 | 2937 |
-- |
2938 |
-- Name: is_more_complete_than(anyelement, anyelement); Type: FUNCTION; Schema: util; Owner: -
|
|
2938 |
-- Name: is_log_level(text); Type: FUNCTION; Schema: util; Owner: -
|
|
2939 | 2939 |
-- |
2940 | 2940 |
|
2941 |
CREATE FUNCTION is_more_complete_than("left" anyelement, "right" anyelement) RETURNS boolean
|
|
2941 |
CREATE FUNCTION is_log_level(raise_type text) RETURNS boolean
|
|
2942 | 2942 |
LANGUAGE sql IMMUTABLE |
2943 | 2943 |
AS $_$ |
2944 |
SELECT $1 IS NOT DISTINCT FROM $2 OR ($1 IS NOT NULL AND $2 IS NULL)
|
|
2944 |
SELECT raise_type ~ '^[[:upper:]]{3,}[[:digit:]]?$'
|
|
2945 | 2945 |
$_$; |
2946 | 2946 |
|
2947 | 2947 |
|
2948 | 2948 |
-- |
2949 |
-- Name: is_populated_more_often_than(anyelement, anyelement); Type: FUNCTION; Schema: util; Owner: -
|
|
2949 |
-- Name: is_more_complete_than(anyelement, anyelement); Type: FUNCTION; Schema: util; Owner: -
|
|
2950 | 2950 |
-- |
2951 | 2951 |
|
2952 |
CREATE FUNCTION is_populated_more_often_than("left" anyelement, "right" anyelement) RETURNS boolean
|
|
2952 |
CREATE FUNCTION is_more_complete_than("left" anyelement, "right" anyelement) RETURNS boolean
|
|
2953 | 2953 |
LANGUAGE sql IMMUTABLE |
2954 | 2954 |
AS $_$ |
2955 |
SELECT $1 IS NOT NULL >= $2 IS NOT NULL -- true > false
|
|
2955 |
SELECT $1 IS NOT DISTINCT FROM $2 OR ($1 IS NOT NULL AND $2 IS NULL)
|
|
2956 | 2956 |
$_$; |
2957 | 2957 |
|
2958 | 2958 |
|
2959 | 2959 |
-- |
2960 |
-- Name: is_raise_condition(text); Type: FUNCTION; Schema: util; Owner: -
|
|
2960 |
-- Name: is_populated_more_often_than(anyelement, anyelement); Type: FUNCTION; Schema: util; Owner: -
|
|
2961 | 2961 |
-- |
2962 | 2962 |
|
2963 |
CREATE FUNCTION is_raise_condition(raise_type text) RETURNS boolean
|
|
2963 |
CREATE FUNCTION is_populated_more_often_than("left" anyelement, "right" anyelement) RETURNS boolean
|
|
2964 | 2964 |
LANGUAGE sql IMMUTABLE |
2965 | 2965 |
AS $_$ |
2966 |
SELECT raise_type ~ '^[[:upper:]]{3,}[[:digit:]]?$'
|
|
2966 |
SELECT $1 IS NOT NULL >= $2 IS NOT NULL -- true > false
|
|
2967 | 2967 |
$_$; |
2968 | 2968 |
|
2969 | 2969 |
|
... | ... | |
4093 | 4093 |
AS $_$ |
4094 | 4094 |
SELECT CASE |
4095 | 4095 |
WHEN util.is_sqlstate(raise_type) THEN $$SQLSTATE $$||quote_literal(raise_type) |
4096 |
WHEN util.is_raise_condition(raise_type) THEN raise_type -- only if not SQLSTATE
|
|
4096 |
WHEN util.is_log_level(raise_type) THEN raise_type -- only if not SQLSTATE
|
|
4097 | 4097 |
ELSE raise_type |
4098 | 4098 |
END |
4099 | 4099 |
$_$; |
Also available in: Unified diff
fix: schemas/util.sql: is_raise_condition(): should be called is_log_level()