Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from brimstone/add-function_get_player_symbol
Add function get_player_symbol() Woo! Thanks for the bug fix :)
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Deploy schemaverse:function-get_player_symbol to pg | ||
-- requires: table-player | ||
|
||
BEGIN; | ||
|
||
CREATE OR REPLACE FUNCTION public.get_player_symbol(check_id integer) | ||
RETURNS character | ||
LANGUAGE sql | ||
STABLE SECURITY DEFINER | ||
AS $function$ | ||
SELECT symbol FROM public.player WHERE id=$1; | ||
$function$; | ||
|
||
|
||
CREATE OR REPLACE FUNCTION public.get_player_symbol(check_username name) | ||
RETURNS character | ||
LANGUAGE sql | ||
STABLE SECURITY DEFINER | ||
AS $function$ | ||
SELECT symbol FROM public.player WHERE username=$1; | ||
$function$; | ||
|
||
GRANT EXECUTE ON FUNCTION public.get_player_symbol(integer) TO players; | ||
GRANT EXECUTE ON FUNCTION public.get_player_symbol(name) TO players; | ||
|
||
COMMIT; |
This file contains 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