Bug: `USE GRAPH` on one connection changes the current graph for every connection on the Database
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- bun, cpp, databases, typescript
- Domain
- database
Research direction
Start by reproducing the behavior with the two-connection TypeScript example in the issue, then trace how USE GRAPH selects the current graph and how connections share that state. The issue identifies no source files or tests, so locating the relevant implementation will require repository exploration. Done means confirming whether graph selection is intended to be database-wide and, if it should be per connection, showing that connection B still queries main after A switches to alpha.
Written by the indexing model from the issue text.
Description
Ladybug version
@ladybugdb/core 0.22.3 (npm), also seen on 0.23.0-dev.20261105
What operating system are you using?
macOS 27 (arm64), and Linux arm64 in the oven/bun:1.4.4 container. The Node binding was run under Bun 1.4.4.
What happened?
USE GRAPH run on connection A also changes the graph that a second connection, B, reads, even though B never ran USE GRAPH. B's fresh (uncached) query reads the subgraph A switched to instead of main.
This makes subgraphs unsafe for any program that holds more than one connection. For example, a writer connection that switches graphs while a reader connection is querying would send the reader's queries to the wrong graph.
#1274 notes the same database-wide behaviour in passing, as part of a prepared-statement caching bug. This report is about the scope itself: is the current graph meant to be database-wide? If so, it would help to document that. If not, we would expect USE GRAPH to be per connection, like USE DATABASE in relational systems, which the CREATE GRAPH docs compare it to.
Are there known steps to reproduce?
import * as lb from '@ladybugdb/core';
const db = new lb.Database('/tmp/use-graph-scope/g.lbug');
const a = new lb.Connection(db);
const b = new lb.Connection(db);
const run = async (c: lb.Connection, q: string) => (await c.query(q)).getAll();
await run(a, 'CREATE NODE TABLE Entity(key STRING PRIMARY KEY)');
await run(a, "CREATE (:Entity {key: 'in-main'})");
await run(a, 'CREATE GRAPH alpha');
await run(a, 'USE GRAPH alpha');
await run(a, 'CREATE NODE TABLE Entity(key STRING PRIMARY KEY)');
await run(a, "CREATE (:Entity {key: 'in-alpha'})");
// b never ran USE GRAPH
console.log(await run(b, 'MATCH (e:Entity) RETURN e.key'));
// expected: [{ 'e.key': 'in-main' }]
// actual: [{ 'e.key': 'in-alpha' }]
- Dominant language
- C++
- Stars
- 1.8k
- Forks
- 148
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 176
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LadybugDB/ladybug
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Bug: a filtered scan reads ALP-compressed DOUBLE exceptions as 0.0 when a batch straddles a segment boundaryPossibly taken @jfrench9 claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Process aborts on a null ValueVector dereference during a relink rollback test (0.20.4, GCC 15)Possibly taken @adsharma claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
LadybugDB/ladybug#1536 · 8 comments ·
Maintainers usually reply within 1 day
-
Bug: primary-key match over an Arrow rel table also returns the first node's relsPossibly taken @zahariash claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 54/100
Maintainers usually reply within 1 day
All issues in LadybugDB/ladybug
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
godotengine/godot#125272 ·
Maintainers usually reply within 1 day
-
bug impact: performance priority: med review: 2026-11 severity: med
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
mgradwohl/ModernLife#67 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
games-on-whales/wolf#569 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/workerd#8290 ·
Maintainers usually reply within 1 day
-
arch-based bug mango
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
noctalia-dev/noctalia#5293 ·
Maintainers usually reply within 1 day