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

branch beam-0500: Updates with the field referenced at the right hand side of the assignment #15

Closed
gibranrosa opened this issue Apr 11, 2017 · 2 comments

Comments

@gibranrosa
Copy link

With the code below:
runUpdate $ update ordersT (\order -> [_orderAmount order <-. (_orderAmount order *100)]) (\order -> _orderTakenBy order ==. (pk tomJones))

It shows the error:
Error: * Couldn't match type QField s Scientific' with QGenExpr QValueContext FirebirdExpressionSyntax s Scientific'
Expected type: QExpr FirebirdExpressionSyntax s Scientific
Actual type: Columnar (QField s) Scientific

  • In the first argument of (*)', namely _orderAmount order'
    In the second argument of (<-.)', namely (_orderAmount order * 100)'
    In the expression:
    _orderAmount order <-. (_orderAmount order * 100)
  • Relevant bindings include
    order :: OrderT (QField s) (bound at example\EmployeesFB.hs:211:19)
@tathougies
Copy link
Collaborator

tathougies commented Apr 11, 2017

The problem here is that order in the second argument to update is parameterized over QField, which is conceptually the type of expressions on the 'left-hand side' of the UPDATE ... SET ... assignments. However, you want to use it as both a QField and QExpr -- this is a case I hadn't thought of, but ought to be supported.

We could pass in two tables to the second argument of update (one QField and one QExpr), but then the syntax becomes awkward and obtuse.

Any ideas on a better solution / syntax?

@gibranrosa
Copy link
Author

It worked! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants