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

Bug: UPDATE does not respect WHERE is NOT NONE in Aggregate Table when Old Record IS NOT NONE #3966

Open
2 tasks done
ioannist opened this issue Apr 30, 2024 · 0 comments
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@ioannist
Copy link

Describe the bug

If you define an aggregate table using WHERE something IS NONE, it works fine unless you try to UPDATE a property that was previously NOT NONE to a NONE property. So, it looks like the WHERE clause is not applied or is applied at the wrong place in the logic. I have prepared a short script to reproduce this.

Steps to reproduce

REMOVE TABLE wallet;
REMOVE TABLE wallet_mean;

UPDATE wallet:1 CONTENT {
    value: 10,
    day: 1,
};

UPDATE wallet:4 CONTENT {
    day: 1,
};

DEFINE TABLE IF NOT EXISTS wallet_mean AS SELECT
math::mean(value) as value, day FROM wallet WHERE value is NOT NONE GROUP BY day;

UPDATE wallet:10 CONTENT {
    value: 10,
    day: 1,
};

UPDATE wallet:10 CONTENT {
    day: 1,
};

OUTPUT:


-------- Query 1 (649.924µs) --------

NONE

-------- Query 2 (395.707µs) --------

NONE

-------- Query 3 (700.934µs) --------

[
	{
		day: 1,
		id: wallet:1,
		value: 10
	}
]

-------- Query 4 (117.779µs) --------

[
	{
		day: 1,
		id: wallet:4
	}
]

-------- Query 5 (742.423µs) --------

NONE

-------- Query 6 (291.048µs) --------

[
	{
		day: 1,
		id: wallet:10,
		value: 10
	}
]

-------- Query 7 (99.389µs) --------

"Cannot perform addition with '20' and 'NONE'"

Expected behaviour

The UPDATE should execute without errors because the aggregate view has a WHERE value IS NOT NONE clause.

SurrealDB version

v1.4.2

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
@ioannist ioannist added bug Something isn't working triage This issue is new labels Apr 30, 2024
@ioannist ioannist changed the title Bug: "Cannot perform addition with '24' and 'NONE'" Bug: UPDATE does not respect WHERE is NOT NONE in Aggregate Table when Old Record IS NOT NONE Apr 30, 2024
@emmanuel-keller emmanuel-keller self-assigned this May 3, 2024
@emmanuel-keller emmanuel-keller removed the triage This issue is new label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants