mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
12 lines
299 B
PL/PgSQL
12 lines
299 B
PL/PgSQL
CREATE OR REPLACE FUNCTION public.lookup_email_by_username(_username text)
|
|
RETURNS text
|
|
LANGUAGE sql
|
|
STABLE SECURITY DEFINER
|
|
SET search_path TO 'public'
|
|
AS $$
|
|
SELECT u.email
|
|
FROM public.profiles p
|
|
JOIN auth.users u ON u.id = p.user_id
|
|
WHERE lower(p.username) = lower(_username)
|
|
LIMIT 1
|
|
$$; |