tursodatabase / tursodatabase/libsql

conn.changes() always returns 0 on remote connection.

Open
#1,434 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug remote protocol
Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

let conn = Builder::new_remote("http://localhost:8867".into(), "".into())...;
conn.execute_batch(r#"CREATE TABLE IF NOT EXISTS example (id INTEGER NOT NULL PRIMARY KEY);"#)...;

conn.query(r#"INSERT INTO example DEFAULT VALUES RETURNING *;"#, ())
        .await
        .unwrap();
// Error
assert_eq!(conn.changes(), 1); 

// or

let mut stam = conn
        .prepare(r#"INSERT INTO example DEFAULT VALUES RETURNING *;"#)
        .await
        .unwrap();
stam.query(()).await.unwrap();
// Error
assert_eq!(conn.changes(), 1);
assertion `left == right` failed
  left: 0
 right: 1

It seems that only the query method of the remote connection has an issue; there are no problems whatsoever when using a local connection.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Builder::new_remote connection path and compare conn.query with prepare followed by query, focusing on how conn.changes() is reported. Reproduce both examples against the remote connection and verify that an INSERT returning one row reports changes() as 1, while local connection behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.