525ced6ec90624e196a47ac5bc8479b5e5746014
[squeep-indie-auther] / src / db / postgres / sql / profiles-scopes-by-identifier.sql
1 --
2 SELECT p.profile, s.*
3 FROM profile p
4 INNER JOIN authentication a USING (identifier_id)
5 FULL JOIN profile_scope ps USING (profile_id)
6 FULL JOIN scope s USING (scope_id)
7 WHERE a.identifier = $(identifier)
8 UNION ALL SELECT NULL AS profile, *
9 FROM scope
10 WHERE is_manually_added OR is_permanent