It appears that
has, err := x.Get(&PublicKey{ Content: content, Type: KeyTypeUser, })
Where content is of type varchar(max). The content query condition is ignored. This ends up checking on the type condition, and returning incorrect values.
MSSQL does support querying on text columns. Eg the below works
has, err := x.Where("content=?",content).Where("type=?",KeyTypeUser).Get(&PublicKey{})
Go-xorm should either support that in the "bean" or error out if it is not supported. Silently dropping it leads to unexpected results.
From https://github.com/go-gitea/gitea/issues/697
It appears that
has, err := x.Get(&PublicKey{ Content: content, Type: KeyTypeUser, })
Where content is of typevarchar(max)
. The content query condition is ignored. This ends up checking on the type condition, and returning incorrect values.MSSQL does support querying on text columns. Eg the below works
has, err := x.Where("content=?",content).Where("type=?",KeyTypeUser).Get(&PublicKey{})
Go-xorm should either support that in the "bean" or error out if it is not supported. Silently dropping it leads to unexpected results.