summaryrefslogtreecommitdiff
path: root/sql/functions/auth.get_all_active_users.sql
blob: 243be6316b700400a6448ca42fd15b9d15fb3089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
drop function auth.get_all_active_users ();

create or replace function auth.get_all_active_users ()
returns setof auth.users
as $$
begin
    return query
    select u.id,
        u.username,
        u.pwd,
        u.first_name,
        u.last_name,
        u.email,
        u.phone,
        u.active,
        u.created
    from auth.users u
    where u.active = true::bool
    order by u.last_name asc,
        u.first_name asc,
        u.id asc;

    return;
end;
$$ language plpgsql;