Skip to content

Commit

Permalink
fix(sql): add additional join argument to resolve MySQL query issue
Browse files Browse the repository at this point in the history
Closes #2262
  • Loading branch information
aeneasr committed May 13, 2022
1 parent b682689 commit 854e5cb
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions persistence/sql/persister_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func (p *Persister) normalizeIdentifier(ct identity.CredentialsType, match strin
func (p *Persister) FindByCredentialsIdentifier(ctx context.Context, ct identity.CredentialsType, match string) (*identity.Identity, *identity.Credentials, error) {
nid := corp.ContextualizeNID(ctx, p.nid)

var cts []identity.CredentialsTypeTable
if err := p.GetConnection(ctx).All(&cts); err != nil {
return nil, nil, sqlcon.HandleError(err)
}

var find struct {
IdentityID uuid.UUID `db:"identity_id"`
}
Expand All @@ -90,7 +85,7 @@ func (p *Persister) FindByCredentialsIdentifier(ctx context.Context, ct identity
ic.identity_id
FROM %s ic
INNER JOIN %s ict on ic.identity_credential_type_id = ict.id
INNER JOIN %s ici on ic.id = ici.identity_credential_id
INNER JOIN %s ici on ic.id = ici.identity_credential_id AND ici.identity_credential_type_id = ict.id
WHERE ici.identifier = ?
AND ic.nid = ?
AND ici.nid = ?
Expand Down

0 comments on commit 854e5cb

Please sign in to comment.