Repository navigation
Fix bugs found by the final pre-release sweep - #47
Merged
Merged
Conversation
- MySQL :copyfrom into JSON columns (LOAD DATA CHARACTER SET binary): convert JSON columns via user variables - PostgreSQL :copyfrom with booleans: text boolean encoder - PostgreSQL nested transaction rescuing a failed statement: roll back only the savepoint - PostgreSQL array parameters (bytea[], jsonb[], [] / leading nil, preparedStatements: false) as array literals; floats as exact text - :copyfrom keeps INSERT OR REPLACE / OR IGNORE / ON CONFLICT (SQLite), INSERT IGNORE / REPLACE (MySQL); rejects clauses COPY / LOAD DATA cannot express - acronym-aware snake_case (MIN_ID -> min_id); RuboCop exemptions only where needed (Naming/VariableNumber) - mysql2 batches prepare per row; nested isolation:/mode: raise; dead connections reset (pg) / discarded from the pool (mysql2) - E2E tests for every case Co-Authored-By: Doron Eli Rachman <doron050@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
doron050
approved these changes
Nov 3, 2026
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
Fixes the bugs found by the final pre-release sweep of 7e813b7, with an end-to-end test for each.
:copyfrominto JSON columns (regression from Fix bugs found by the pre-release sweep, update docs #46):LOAD DATA ... CHARACTER SET binarycan't create JSON values. JSON columns now load into@sqlc_vNwithSET col = CONVERT(@sqlc_vN USING utf8mb4).:copyfromwith booleans: the default binary boolean encoder sent invalid COPY text. Booleans now usePG::TextEncoder::Boolean.transactionrescuing a failed statement: this used to poison the outer transaction. Now only the savepoint is rolled back,PG::InFailedSqlTransactionis raised, and the outer block can rescue it and continue.bytea[](binary/NUL),jsonb[](Hash elements),[]and leadingnil, andpreparedStatements: false. These are now sent as array literals (encode_array). Floats are sent as exact text (Float#to_s).:copyfromconflict clauses: SQLite keepsINSERT OR REPLACE/OR IGNORE/ON CONFLICT ... DO .... MySQL mapsINSERT IGNOREandREPLACEtoLOAD DATA ... IGNORE|REPLACE INTO TABLE. Clauses COPY / LOAD DATA can't express are generation errors:ON CONFLICT/RETURNINGon PostgreSQL,ON DUPLICATE KEY UPDATEon MySQL.snake_casekeeps acronyms together (MIN_ID→min_id, notm_i_n_i_d). RuboCop exemptions are emitted only where a name offends, includingNaming/VariableNumberfor repeated parameters (id_2).CONNECTION_BADconnection on checkout. mysql2 discards a closed connection from the pool.transaction(isolation:)/transaction(mode:)now raiseArgumentErrorinstead of being silently ignored.Drivers get the parsed verb/tail through
copy_from_lines(..., query_name:, sources:, verb:, tail:)and aprepares_batch_rows?hook.New example tables back the e2e tests:
batch_types(pg),copy_types(mysql),tags(sqlite). README documents the new behaviour and limitations.Behaviour changes (release notes)
transactionwithisolation:/mode:raisesArgumentError.:copyfromquery withON CONFLICT/RETURNING(PostgreSQL) orON DUPLICATE KEY UPDATE(MySQL) is rejected at generation time.Verified locally
rake test: Ruby 3.1–3.4.PG/Mysql2constant references changed.sqlc diff: clean through both the newly builtdist/plugin.wasmandexe/plugin.rb.bytea[],jsonb[],Float::MAXand5e-324.Checklist
examples/is regenerated (rake sqlc_generate_process) and committedrake test, andrake end2end_*when the generated code changes)rake rubocop) and Steep-clean (rake steep)bug,enhancement,documentation, orbreaking) so the release notes are grouped correctly