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] Query Workbench: Semicolon in SQL strings terminates query #243

Open
smacrakis opened this issue Dec 28, 2023 · 4 comments
Open

[BUG] Query Workbench: Semicolon in SQL strings terminates query #243

smacrakis opened this issue Dec 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@smacrakis
Copy link

Describe the bug

In the Query Workbench, the SQL query << select "foo;bar" >> gives an error because it is segmenting the query at the semicolon, even though the semicolon is within a quoted string.

The problem is with Query Workbench since submitting the query using POST /_plugins/_sql works fine.

Tested on https://playground.opensearch.org/app/home

Related component

Other

To Reproduce

Go to https://playground.opensearch.org/app/opensearch-query-workbench#/ .
Enter the query
select "foo;bar"
Run.
See the errors:

Select "foo: Bad Request, this query is not runnable. 

Bar": Bad Request, this query is not runnable. 

It is strange that it capitalizes "Bar" in the error message....

Expected behavior

There should be one result row
foo;bar
with no error.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@smacrakis smacrakis added bug Something isn't working untriaged labels Dec 28, 2023
@macohen
Copy link

macohen commented Jan 10, 2024

@opensearch-project/admin can this issue be moved to https://github.com/opensearch-project/dashboards-query-workbench, please? Thanks!

@macohen macohen removed the untriaged label Jan 10, 2024
@gaiksaya gaiksaya transferred this issue from opensearch-project/OpenSearch Jan 10, 2024
@ps48 ps48 removed the untriaged label Jan 11, 2024
@ps48
Copy link
Member

ps48 commented Jan 11, 2024

@smacrakis This may be the expected behaviour, where workbench tries to run multiple queries in UI and these queries are separated with semi-colon.

  1. To reproduce the error on our side: Can you please provide us with sample data that you're using and the related queries which use semi-colon.
  2. Did you see the same behavior when using backticks `foo;bar`

@smacrakis
Copy link
Author

Sample data is not needed. The SQL query << select "foo" >> correctly returns the value << foo >>.

OpenSearch SQL does not support backticks for quoting strings. Entering the query << select foo >> gives << Bad Request, this query is not runnable. >>

OpenSearch SQL allows doublequote (") and singlequote (') for quoting strings. But Query Workbench doesn't understand that semicolons within quoted strings do not separate SQL queries:

<< select 'foo;bar' >> => error
<< select "foo;bar" >> => error

How can I enter a string including a semicolon in Query Workbench?

@ps48
Copy link
Member

ps48 commented Feb 14, 2024

Was able to reproduce the issue:

select 'foo;bar' -> works in dashboards dev tools/API but doesn't work as expected in workbench.

This is due to the way workbench is built to run multiple queries at a time. It supports multiple queries to be run which are separated by ;. In the above query workbench is trying to split foo and bar as it sees a semicolon.

Action Item: Update split queries by checking if the ; resides within quotes

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
Status: Later (6 months plus)
Development

No branches or pull requests

3 participants