Hi Mark,

> This is fn_mail_user_get_active_smtp:
>
> CREATE FUNCTION fn_mail_user_get_active_smtp(character varying) RETURNS
> SETOF users
>    LANGUAGE plpgsql
>    AS $_$
>
> DECLARE
>
>    in_email       ALIAS for $1;
>    usercheck      users%ROWTYPE;
>
> BEGIN
>
>        SELECT INTO usercheck
>                *
>        FROM
>            users
>        WHERE
>            userid || '@' || domain  = lower(in_email)
>            AND
>            status IN (1,2)
>            AND
>            b_isadmin IS FALSE
>        ORDER BY
>            userid;
>
>        RETURN NEXT usercheck;
> END;$_$;

Do you have a race condition on the usercheck table where two login 
attempts are happening simultaneously? How do rows get deleted from this 
table? Why don't you use a plain simple SELECT() instead to avoid both 
problems?

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to