Project

General

Profile

« Previous | Next » 

Revision 13139

bugfix: schemas/util.sql: is_castable(): need to pass NULL through, for proper NULL propagation

View differences:

trunk/schemas/util.sql
1921 1921
    AS $$
1922 1922
BEGIN
1923 1923
	PERFORM util.cast(value, ret_type_null);
1924
	-- must happen *after* cast check, because NULL is not valid for some types
1925
	IF value IS NULL THEN RETURN NULL; END IF; -- pass NULL through
1924 1926
	RETURN true;
1925 1927
EXCEPTION
1926 1928
WHEN data_exception THEN RETURN false;
......
1933 1935
--
1934 1936

  
1935 1937
COMMENT ON FUNCTION is_castable(value text, ret_type_null anyelement) IS '
1938
passes NULL through. however, if NULL is not valid for the type, false will be
1939
returned instead.
1940

  
1936 1941
ret_type_null: NULL::ret_type
1937 1942
';
1938 1943

  

Also available in: Unified diff