Fix WarnOnConflict

postgres doesn't like 'value = null' for some reason
Closes #223.
This commit is contained in:
spiral 2021-07-13 02:31:06 -04:00
parent afd8983abe
commit 30d1bf6926
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

@ -34,7 +34,7 @@ namespace PluralKit.Bot
async Task<bool> WarnOnConflict(ProxyTag newTag) async Task<bool> WarnOnConflict(ProxyTag newTag)
{ {
var query = "select * from (select *, (unnest(proxy_tags)).prefix as prefix, (unnest(proxy_tags)).suffix as suffix from members where system = @System) as _ where prefix = @Prefix and suffix = @Suffix and id != @Existing"; var query = "select * from (select *, (unnest(proxy_tags)).prefix as prefix, (unnest(proxy_tags)).suffix as suffix from members where system = @System) as _ where prefix is not distinct from @Prefix and suffix is not distinct from @Suffix and id != @Existing";
var conflicts = (await _db.Execute(conn => conn.QueryAsync<PKMember>(query, var conflicts = (await _db.Execute(conn => conn.QueryAsync<PKMember>(query,
new {Prefix = newTag.Prefix, Suffix = newTag.Suffix, Existing = target.Id, system = target.System}))).ToList(); new {Prefix = newTag.Prefix, Suffix = newTag.Suffix, Existing = target.Id, system = target.System}))).ToList();