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: UPSERT fails to execute when the entry is present #118

Open
2 tasks done
orimay opened this issue Nov 7, 2024 · 1 comment
Open
2 tasks done

Bug: UPSERT fails to execute when the entry is present #118

orimay opened this issue Nov 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@orimay
Copy link
Contributor

orimay commented Nov 7, 2024

Describe the bug

Whenever I use UPSERT statement, and the entry already exists ,I get the following error:

Uncaught ResponseError: There was a problem with a datastore transaction: An IndexedDB error occured: failed to execute indexed db request: ConstraintError: Key already exists in the object store.

Steps to reproduce

import { Surreal } from 'surrealdb';
import { surrealdbWasmEngines } from '@surrealdb/wasm';

const db = new Surreal({
  engines: surrealdbWasmEngines({
    strict: false,
    capabilities: {
      guest_access: true,
      functions: true,
      network_targets: true,
    },
  }),
});

await db.connect(`test://ns/db`);

await db.use({
  namespace: 'ns',
  database: 'db',
});

await db.query('UPSERT _:1 SET q = 1;');
await db.query('UPSERT _:1 SET q = 2;'); // fails

Expected behaviour

Should update on matching id

SurrealDB version

"surrealdb": "^1.0.6", "@surrealdb/wasm": "^1.0.2"

Contact Details

[email protected]

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
@orimay orimay added the bug Something isn't working label Nov 7, 2024
@orimay
Copy link
Contributor Author

orimay commented Nov 7, 2024

Same happens with INSERT with ON DUPLICATE KEY UPDATE

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

1 participant