Skip to content

[BUGFIX] consider fields to ignore when generating new records sql#8

Merged
jasdeepkhalsa merged 1 commit intoDBDiff:masterfrom
webian:master
May 22, 2016
Merged

[BUGFIX] consider fields to ignore when generating new records sql#8
jasdeepkhalsa merged 1 commit intoDBDiff:masterfrom
webian:master

Conversation

@webian
Copy link
Copy Markdown
Contributor

@webian webian commented May 22, 2016

Bug: if servers are different and there are fields to ignore, the generated SQL for new records didn't include the ignored fields. This commit fixes this bug unsetting the array element to ignore only when the comparison is made.

Bug: if servers are different and there are fields to ignore, the generated SQL for new records didn't include the ignored fields. This commit fixes this bug unsetting the array element to ignore only when the comparison is made.
@jasdeepkhalsa
Copy link
Copy Markdown
Member

Thanks for that! I don't have much time to thoroughly test new features so glad you've taken the initiative :)

@jasdeepkhalsa jasdeepkhalsa merged commit a9ddde5 into DBDiff:master May 22, 2016
jasdeepkhalsa added a commit that referenced this pull request Mar 25, 2026
InsertDataSQL::getUp() and DeleteDataSQL::getDown() now emit explicit
column name lists: INSERT INTO `t` (`col1`,`col2`) VALUES(...)
instead of positional INSERT INTO `t` VALUES(...).

This prevents silent data corruption when source and target tables have
identical columns in different order (common after ALTER TABLE ADD on
different servers). Also handles NULL values correctly in the column list.

Added unit tests covering:
- Column names included in INSERT output
- NULL value handling in INSERT
- DELETE UP/DOWN direction correctness

Refs: bugs.md Bug #8
jasdeepkhalsa added a commit that referenced this pull request Mar 25, 2026
Bug #8 changed INSERT statements from positional VALUES to explicit
column lists:
  Before: INSERT INTO "posts" VALUES('3','2',...)
  After:  INSERT INTO "posts" ("id","user_id",...) VALUES('3','2',...)

Update all affected PostgreSQL (14-18) comprehensive test baselines
and the end2end baselines for both PostgreSQL and SQLite to match
the new correct output. MySQL baselines were unaffected.
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.

2 participants