11 lines
183 B
PL/PgSQL
11 lines
183 B
PL/PgSQL
CREATE FUNCTION _api.get_user_id()
|
|
RETURNS INTEGER
|
|
LANGUAGE plpgsql VOLATILE
|
|
AS $BODY$
|
|
BEGIN
|
|
RETURN CURRENT_SETTING(
|
|
'request.jwt.claims',
|
|
TRUE
|
|
)::JSON->>'user_id';
|
|
END
|
|
$BODY$;
|