Skip to content

Commit

Permalink
Handle resultsFormat in D1 worker
Browse files Browse the repository at this point in the history
This PR fixes cloudflare#3160 caused by ignoring the `resultsFormat` query that `workerd` sends.

The commits add proper handling of the query. It makes `raw` preserve columns with the same name by handling `resultsFormat=ROWS_AND_COLUMNS` and removes `results` from `run` as it sends `resultsFormat=NONE` (see https://github.com/cloudflare/workerd/blob/1d89f3b8e9cdcd898ea486656d72d9551e79f4a3/src/cloudflare/internal/d1-api.ts#L295)
  • Loading branch information
kossnocorp committed May 27, 2024
1 parent 872e312 commit 5061886
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/little-jars-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"miniflare": minor
---

Fix JOIN behaviour when selecting columns with the same name.

Properly handle the `resultsFormat` query that `workerd` sends. This fixes [the JOIN bug](https://github.com/cloudflare/workers-sdk/issues/3160) and makes the behaviour of `raw`, `exec`, and `run` consistent with the `workerd` behaviour.
1 change: 0 additions & 1 deletion packages/miniflare/src/workers/d1/database.worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import assert from "node:assert";
import {
all,
get,
HttpError,
MiniflareDurableObject,
Expand Down

0 comments on commit 5061886

Please sign in to comment.