iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: http://github.com/surrealdb/surrealdb/issues/4997
Feature: Support conditional assignment in transaction. · Issue #4997 · surrealdb/surrealdb · GitHub
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

Feature: Support conditional assignment in transaction. #4997

Open
2 tasks done
C928 opened this issue Oct 19, 2024 · 3 comments
Open
2 tasks done

Feature: Support conditional assignment in transaction. #4997

C928 opened this issue Oct 19, 2024 · 3 comments
Labels
feature New feature or request

Comments

@C928
Copy link

C928 commented Oct 19, 2024

Describe the bug

When using an if statement inside a transaction and assigning to a variable,
the variable value isn't updated outside the transaction.

Without the if, the variable value is successfully updated outside the transaction.

This works ($a is equal to "alice"):

$a = "bob";
begin transaction;
$a = "alice";
commit transaction;
return $a;

This works too (the transaction returns "alice"):

$a = "bob";
begin transaction;
if true {
    $a = "alice";
    return $a;
};
commit transaction;

Steps to reproduce

$a = "bob";
begin transaction;
if true {
   $a = "alice"; 
};
commit transaction;
return $a;

Expected behaviour

$a should be equal to "alice"

SurrealDB version

surreal 2.0.4 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@C928 C928 added bug Something isn't working triage This issue is new labels Oct 19, 2024
@dbaudisch
Copy link

The issue is not related to transactions, but that value of variables cannot be reassigned in a nested scope (i.e. inside IF and FOR blocks)

@C928
Copy link
Author

C928 commented Oct 21, 2024

Thank you for your comment. I hadn't tested without transactions. I will leave the ticket open as I don't know if this is an intended feature or not (and could not find it in the docs).

@C928
Copy link
Author

C928 commented Oct 21, 2024

I guess this is more of a feature request then

@DelSkayn DelSkayn added feature New feature or request and removed bug Something isn't working triage This issue is new labels Oct 31, 2024
@DelSkayn DelSkayn changed the title Bug: Conditional assignment in transaction not working Feature: Support conditional assignment in transaction. Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants