X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Fdb%2Fpostgres%2Fsql%2Fprofiles-scopes-by-identifier.sql;fp=src%2Fdb%2Fpostgres%2Fsql%2Fprofiles-scopes-by-identifier.sql;h=525ced6ec90624e196a47ac5bc8479b5e5746014;hp=0000000000000000000000000000000000000000;hb=b0103b0d496262c438b40bc20304081dbfe41e73;hpb=8ed81748bce7cea7904cac7225b20a60cafdfc16 diff --git a/src/db/postgres/sql/profiles-scopes-by-identifier.sql b/src/db/postgres/sql/profiles-scopes-by-identifier.sql new file mode 100644 index 0000000..525ced6 --- /dev/null +++ b/src/db/postgres/sql/profiles-scopes-by-identifier.sql @@ -0,0 +1,10 @@ +-- +SELECT p.profile, s.* + FROM profile p + INNER JOIN authentication a USING (identifier_id) + FULL JOIN profile_scope ps USING (profile_id) + FULL JOIN scope s USING (scope_id) + WHERE a.identifier = $(identifier) +UNION ALL SELECT NULL AS profile, * + FROM scope + WHERE is_manually_added OR is_permanent