Skip to content

fix: add missing insert_format/bulk_insert_format to PostgresGrammar#130

Merged
bedus-creation merged 2 commits into
mainfrom
fix/postgres-bulk-insert-format
Jun 19, 2026
Merged

fix: add missing insert_format/bulk_insert_format to PostgresGrammar#130
bedus-creation merged 2 commits into
mainfrom
fix/postgres-bulk-insert-format

Conversation

@bedus-creation

Copy link
Copy Markdown
Contributor

Summary

PostgresGrammar was missing insert_format() and bulk_insert_format(), which BaseGrammar._compile_bulk_create() depends on. Seeders running against the Postgres grammar crashed with:

AttributeError: 'PostgresGrammar' object has no attribute 'bulk_insert_format'

The MySQL, SQLite, and MSSQL grammars all define these methods — Postgres was the only one missing them.

Changes

Added both methods to PostgresGrammar (after delete_format()), mirroring the SQL used by the other grammars:

  • insert_format()INSERT INTO {table} ({columns}) VALUES ({values})
  • bulk_insert_format()INSERT INTO {table} ({columns}) VALUES {values}

Testing

  • Verified both methods resolve and return the expected format strings.
  • Existing test suite unaffected (one file changed, two methods added).

PostgresGrammar was missing insert_format() and bulk_insert_format(),
which BaseGrammar._compile_bulk_create() relies on. Seeders using the
Postgres grammar crashed with AttributeError on bulk_insert_format.
Adds both methods, mirroring the MySQL/SQLite/MSSQL grammars.
@bedus-creation

Copy link
Copy Markdown
Contributor Author

🔴 Review verdict: CHANGES REQUESTED — DO NOT MERGE

(Posting as a comment; a formal "request changes" review is blocked because the PR author and reviewer share the same GitHub account in this setup.)

Verified ✅

  • insert_format()INSERT INTO {table} ({columns}) VALUES ({values}) — matches MySQL/SQLite/MSSQL exactly.
  • bulk_insert_format()INSERT INTO {table} ({columns}) VALUES {values} — matches MySQL/SQLite/MSSQL exactly.
  • Diff touches only PostgresGrammar.py (6 insertions); no other grammar files changed.
  • Non-DB suite passes locally: 1493 passed, 7 skipped, 0 failed (live-Postgres DB tests excluded per project convention).

Blocking ⛔

  • No regression test. This was an AttributeError crash on Postgres bulk insert that shipped precisely because nothing exercised these methods. A unit test asserting both format strings on PostgresGrammar is required before approval.

Non-blocking nit 💅

  • Other grammars order insert_format → bulk_insert_format → delete_format; here they were added after delete_format. Cosmetic only — moving them above keeps grammars consistent.

Please push the follow-up commit with the unit test; I will re-review.

Adds a grammar-level unit test (no live Postgres connection) verifying
insert_format() and bulk_insert_format() return the expected SQL, plus a
regression test that compile('bulk_create') builds a multi-row INSERT
without raising AttributeError.
@bedus-creation bedus-creation merged commit dc0cc14 into main Jun 19, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant