CREATE OR REPLACE FUNCTION client.fx_online_users()
RETURNS SETOF client.users AS
$BODY$
--
-- Список пользователей online
--
DECLARE
retRecord RECORD;
BEGIN
FOR retRecord in
SELECT * FROM client.users
WHERE date_part('minute'::text, now() - users.user_lastvisit) < 10::integer
ORDER BY user_lastvisit DESC
LOOP
RETURN NEXT retRecord;
END LOOP;
RETURN;
END;
--
-- eof
--
$BODY$
LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER
COST 100
ROWS 1000;
ALTER FUNCTION client.fx_online_users() OWNER TO sk4_admin;
COMMENT ON FUNCTION client.fx_online_users() IS 'Список online пользователей';
SQL Справочник v0.05 © 2007-2025 Igor Salnikov aka SunDoctor