Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select distinct with return struct results in extra parenthesis #1341

Closed
sujessie opened this issue Aug 2, 2024 · 2 comments · Fixed by #1380
Closed

Select distinct with return struct results in extra parenthesis #1341

sujessie opened this issue Aug 2, 2024 · 2 comments · Fixed by #1380
Assignees
Labels

Comments

@sujessie
Copy link

sujessie commented Aug 2, 2024

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"

@trevornagy
Copy link

I can also repro this. @trueqbit / @fnc12

@fnc12
Copy link
Owner

fnc12 commented Aug 7, 2024

I'll look into it soon after v1.9 release is done

@fnc12 fnc12 moved this to In Progress in sqlite_orm public board Jan 25, 2025
@trueqbit trueqbit self-assigned this Jan 25, 2025
@trueqbit trueqbit linked a pull request Jan 25, 2025 that will close this issue
@trueqbit trueqbit moved this from In Progress to Done in sqlite_orm public board Jan 26, 2025
@trueqbit trueqbit closed this as completed by moving to Done in sqlite_orm public board Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

4 participants