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

Add support for VALUES statement #1049

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

krishvishal
Copy link
Contributor

@krishvishal krishvishal commented Feb 21, 2025

Current:

limbo> VALUES
('Monty Python and the Holy Grail', 1975, 8.2),
('And Now for Something Completely Different', 1971, 7.5);
thread 'main' panicked at core/translate/select.rs:336:14:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After this PR:

Limbo v0.0.15
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> VALUES
('Monty Python and the Holy Grail', 1975, 8.2),
('And Now for Something Completely Different', 1971, 7.5);
Monty Python and the Holy Grail|1975|8.2
And Now for Something Completely Different|1971|7.5
limbo> SELECT * FROM (VALUES (1, 2, 'VALUES'));
1|2|VALUES

Fixes: #866

@krishvishal
Copy link
Contributor Author

krishvishal commented Feb 21, 2025

I can't reproduce the failing fuzz test on my local machine. The failure seems to be related to how string concatenation is handled in limbo and unrelated to the current PR. I will look into it in a separate PR.

@pedrocarlo
Copy link
Contributor

@krishvishal have a look at #1021 and #1038 to see your particular error is fixed there. I am trying to fix some text_casts and @jussisaurio was trying to fix a whole lot more in his.

@krishvishal
Copy link
Contributor Author

@krishvishal have a look at #1021 and #1038 to see your particular error is fixed there. I am trying to fix some text_casts

@pedrocarlo thanks for sharing this.

@krishvishal
Copy link
Contributor Author

@penberg requesting review.

});

if let ast::OneSelect::Values(values) = &select.body.select.as_ref() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we shouldn't need separate specialcasing to handle this. What about e.g. SELECT * from sometable JOIN (VALUES (1),(2),(3))?

It seems VALUES with multiple rows is quite similar to how subqueries work.

@penberg penberg changed the title Add support for VALUES statement. Add support for VALUES statement Feb 26, 2025
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

Successfully merging this pull request may close these issues.

VALUES statements are not supported
3 participants