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

Wrong SQL query on document data deletes the document data #437

Closed
Anphisa opened this issue Mar 16, 2023 · 2 comments
Closed

Wrong SQL query on document data deletes the document data #437

Anphisa opened this issue Mar 16, 2023 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@Anphisa
Copy link

Anphisa commented Mar 16, 2023

Operating System (Polypheny-DB)

No response

Polypheny-DB Version

339fd10

Affected Areas

DB, UI

Browser

Chrome

Client Operating System

Windows 10

Bug Description

When I use a wrong SQL query on document data, I seem to delete the document data.

Reproduction Steps

  • Add a document namespace
  • Put document data in the namespace. I used this MQL code:
db.UserProperties.insert( { userid: "0", age: 20, eyecolor: "brown" } )
db.UserProperties.insert( { userid: "1", age: 40 } )
  • Query the document namespace with a SQL expression that is wrong. I used this query:
SELECT * FROM gavel_doc."userid"

This throws an error:

Error:
From line 1, column 15 to line 1, column 32: Object 'userid' not found within 'gavel_doc'

But it also deletes the document data that was added with the MQL code above. At least, it isn't visible via the UI "Data" element anymore.

Expected Behavior

Throw the same error, but keep the data.

Relevant Log Output

No response

@Anphisa Anphisa added the C-bug Category: This is a bug. label Mar 16, 2023
@datomo
Copy link
Member

datomo commented Mar 19, 2023

Hey @Anphisa, thank you for this issue.
Due to a missing commit on the catalog the implicit creation of the collection with the db.UserProperties.insert( { userid: "0", age: 20, eyecolor: "brown" } ) statement was still not fixed. This was then wrongfully also part of the rollback due to the incorrect query after.
This should be fixed in #437 but requires some testing as I have moved the commit of the catalog into the commit of the transaction itself.

To temporarily bypass this error from happening, the explicit creation of the collection can be used:
db.createCollection(("UserProperties")
This has to be executed between the creation of the namespace and the insertion.

@datomo
Copy link
Member

datomo commented Apr 16, 2023

Fixed in #438.

@datomo datomo closed this as completed Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants