Revision 13136
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
1913 | 1913 |
|
1914 | 1914 |
|
1915 | 1915 |
-- |
1916 |
-- Name: is_castable(text, anyelement); Type: FUNCTION; Schema: util; Owner: - |
|
1917 |
-- |
|
1918 |
|
|
1919 |
CREATE FUNCTION is_castable(value text, ret_type_null anyelement) RETURNS boolean |
|
1920 |
LANGUAGE plpgsql IMMUTABLE |
|
1921 |
AS $$ |
|
1922 |
BEGIN |
|
1923 |
PERFORM util.cast(value, ret_type_null); |
|
1924 |
RETURN true; |
|
1925 |
EXCEPTION |
|
1926 |
WHEN data_exception THEN RETURN false; |
|
1927 |
END; |
|
1928 |
$$; |
|
1929 |
|
|
1930 |
|
|
1931 |
-- |
|
1932 |
-- Name: FUNCTION is_castable(value text, ret_type_null anyelement); Type: COMMENT; Schema: util; Owner: - |
|
1933 |
-- |
|
1934 |
|
|
1935 |
COMMENT ON FUNCTION is_castable(value text, ret_type_null anyelement) IS ' |
|
1936 |
ret_type_null: NULL::ret_type |
|
1937 |
'; |
|
1938 |
|
|
1939 |
|
|
1940 |
-- |
|
1916 | 1941 |
-- Name: is_constant(col_ref); Type: FUNCTION; Schema: util; Owner: - |
1917 | 1942 |
-- |
1918 | 1943 |
|
Also available in: Unified diff
schemas/util.sql: added is_castable()