fix: add missing insert_format/bulk_insert_format to PostgresGrammar#130
Merged
Conversation
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.
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 ✅
Blocking ⛔
Non-blocking nit 💅
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PostgresGrammarwas missinginsert_format()andbulk_insert_format(), whichBaseGrammar._compile_bulk_create()depends on. Seeders running against the Postgres grammar crashed with:The MySQL, SQLite, and MSSQL grammars all define these methods — Postgres was the only one missing them.
Changes
Added both methods to
PostgresGrammar(afterdelete_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