Created
October 28, 2021 15:13
-
-
Save nandilugio/53700bc95f267cfa9362e13310c77a3d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 or replace function value_or_raise( | |
anyelement, | |
if boolean, | |
else_raise text | |
) | |
returns anyelement | |
language plpgsql | |
immutable | |
as $function$ | |
begin | |
if $2 then | |
return $1; | |
else | |
raise exception '%',$3; | |
end if; | |
end; | |
$function$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment