-
Notifications
You must be signed in to change notification settings - Fork 346
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
Using sqlpp::parameterized_verbatim as lhs in comparison results in segfault. #584
Comments
Found a non-crashing workaround:
Is there a better solution than this? |
Actually, you found a bug. You have a talent for finding interesting corner cases, it seems. Keep them coming :-) In this case, I am quite surprised that this even compiled. Fixed in current main. |
Great! Thanks a lot for the quick fix! It did indeed fix the lhs vs rhs issue. and now the expression even works in an And a question about the fix: Shouldn't |
Awesome spot. Yes, indeed, that was wrong, too. |
Hi Roland,
Yet another non-standard parameterized query (SQLite) that I try to make working. This time I need the following expression in a
WHERE
statement:ABS(field1 - param1) <= param2
I tried
This compiles, however when running the
prepare()
method with the statement it results in a segmentation fault. Also using VS Code Intellisense does not detect thefield1
parameter of the statement so this sort of already indicates that this expression is doomed.Am I making a mistake, is this never supposed to work or is it a bug?
Is there a way to make this work?
Best,
Marcell
Update:
I did not think it plays any role if the verbatim is lhs or rhs, but as I ran out of other ideas I tried it being rhs instead of lhs. Lo and behold, as rhs it works!
So this tells me that some combination of types is missing from the comparison operators. Based on this I think this should be considered a bug.
Update2:
When trying to select the same verbatim (i.e.
select(all_of(tbl), verbatim_exp.as(sqlpp::alias::e)).from(tbl).unconditionally();
) it also leads to a segfault runtime. Most probably related to this, but the same expression cannot be used in anorder_by
method as well. So if I have a query likeSELECT *, ABS(field2 - ?) AS diff FROM tbl ORDER BY diff ASC;
the only option seems to be to go full verbatim on the whole query. It appears that as long as theABS
expression is only part of a comparison on the right hand side in the where clause it works. If it appears anywhere else then it is a segfault.The text was updated successfully, but these errors were encountered: