Skip to content

fix(adapter-drizzle): an error names its operation whatever the table is called - #1811

Closed
mobeenabdullah wants to merge 2 commits into
mainfrom
fix/transaction-update-refusal-on-every-dialect
Closed

mobeenabdullah wants to merge 2 commits into
mainfrom
fix/transaction-update-refusal-on-every-dialect

Conversation

@mobeenabdullah

Copy link
Copy Markdown
Collaborator

What

main's Integration fails on the postgres and mysql legs since #1787 (run 34629104960 at 746a714):

× refuses a column the table does not have, naming the operation and the table
expected DatabaseError: Failed query: UPDATE "int_… to match { message: /update operation failed.*ghost/s }

Root cause

Not the test. DrizzleAdapter.handleQueryError adds update operation failed on table '<table>': only when the message does not already contain the bare word update. The fixture table is int_txpg_update_table, and the postgres and mysql messages contain the table name (the echoed statement in this run; the relation name in the server's own text for the same failure), so the check read the prefix as already present and skipped it. SQLite's message for the same failure is no such column: ghost, with no table in it (measured), which is why only that leg passed. So any table or column whose name contains the operation's word (updated_at, *_update_*, inserts, selections) has been losing its operation context on those dialects.

Fix

Check for the exact prefix the method adds. That keeps what the substring check was reaching for (no double prefix when an error is handled twice on its way out) without the false positive. Renaming the fixture table would also have turned the legs green while leaving the bug in place; the unit cases pin the message shapes instead.

Tests

adapter.test.ts: the prefix is added when an echoed statement names a table containing the word, when the server's message names such a relation, and when a column name contains it; it is not added twice. The first two fail on main. adapter-drizzle (184) and adapter-sqlite (66 unit, 12 integration) pass locally; the postgres and mysql legs run on this PR's CI.

Patch changeset, every package (the error text of a published package changes).

… is called

handleQueryError added the operation prefix only when the message lacked
the operation's word. A PostgreSQL or MySQL message carries the failed
SQL, so a table named int_txpg_update_table satisfied that check and the
error went out without its context; main's postgres and mysql legs fail
on exactly that. The check is now for the prefix itself.
…hoed statement

A PostgreSQL error for an unknown column can name the relation in the
server's own text rather than echo the statement; both put the table
name, and so the operation's word, in the message. SQLite's text for
the same failure names no table, which is why only it kept its context.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-11T18:38:57.019796Z e74a33d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ab5fb69f-3e0b-4c77-bce1-52cfb91d07e0

📥 Commits

Reviewing files that changed from the base of the PR and between a5bf4d1 and e74a33d.

⛔ Files ignored due to path filters (1)
  • .changeset/an-error-names-its-operation-whatever-the-table-is-called.md is excluded by !.changeset/**
📒 Files selected for processing (2)
  • packages/adapter-drizzle/src/__tests__/adapter.test.ts
  • packages/adapter-drizzle/src/adapter.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mobeenabdullah

Copy link
Copy Markdown
Collaborator Author

@codex review

@mobeenabdullah

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate of #1807, which landed the same fix (check handleQueryError's context by the text it writes, not the operation's bare word) while this was open. Root-cause notes for the record: sqlite's message for the failure is "no such column: ghost" with no table in it, which is why only that leg passed; postgres and mysql messages carry the table name.

@mobeenabdullah
mobeenabdullah deleted the fix/transaction-update-refusal-on-every-dialect branch September 11, 2026 18:37
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: e74a33d983

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions github-actions Bot added type: docs Documentation only scope: db-adapter @nextlyhq/adapter-* packages labels Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: db-adapter @nextlyhq/adapter-* packages type: docs Documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant