sqlite_orm
sqlite_orm copied to clipboard
Select distinct with return struct results in extra parenthesis
Using select distinct with a return struct generates a statement that includes parenthesis around the columns, resulting in an error. Without distinct, there are no extra parenthesis generated.
Example:
struct User
{
uint32_t id;
std::string name;
};
constexpr auto userStruct = sqlite_orm::struct_<User>(&User::id, &User::name);
auto const selectDistinct = sqlite_orm::distinct(userStruct);
auto statement = sqlite_orm::select(selectDistinct);
auto str = storage->dump(statement);
Resulting SQLite statement:
SELECT DISTINCT(("Users"."id", "Users"."name")) FROM "Users"
Error:
row value misused: SQL logic error
Without distinct:
SELECT "User"."id", "User"."name" FROM "Users"
I can also repro this. @trueqbit / @fnc12
I'll look into it soon after v1.9 release is done