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: Floats treated as integers and duplicate records not checked when floats used as record id #4069

Open
2 tasks done
Dhghomon opened this issue May 20, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working triage This issue is new

Comments

@Dhghomon
Copy link
Contributor

Describe the bug

Floats are treated as ints for record ids, and

Steps to reproduce

CREATE person SET id = 9.8, name = 'Mr. 9.8';
CREATE person SET id = 9.8, name = 'Mr. 9.8';

The output will always be the same, and no error generated that a person:9 already exists.

[
	{
		id: person:9,
		name: 'Mr. 9.8'
	}
]

Interestingly, the same behaviour happens if you specify fewer fields than the existing record:

CREATE person SET id = 9.8;

But it will recognize the id as a duplicate if you change the field value or specify another field.

CREATE person SET id = 9.8, name = 'Mr. 9.8';
CREATE person SET id = 9.8, other = 'other';
CREATE person SET id = 9.8, name = 'Something else';

Expected behaviour

Probably an error that floats can't be used unless enclosed in backticks, like this: CREATE person:9.8;

SurrealDB version

1.5.0 for windows on x86_64

Contact Details

Slack

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
@Dhghomon Dhghomon added bug Something isn't working triage This issue is new labels May 20, 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 triage This issue is new
Projects
None yet
Development

No branches or pull requests

1 participant