Repository navigation
Render aliased tables in data-changing statements as the bare table - #225
Merged
Merged
Conversation
TableGateway keeps an aliased table array on Delete, Update and Insert, but its delete(), insert() and update() raised a TypeError: Sql passed the array to constructors that only accepted string|TableIdentifier, and rendering an array failed in resolveTable(). The constructors now accept the array the setters already took, and rendering drops the alias, since alias syntax in these statements is not portable. A TableGateway test drives each call through a real Sql and Adapter and checks the SQL that reaches the driver. Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…dml-tables # Conflicts: # analyzer-baseline.toml
tyrsson
approved these changes
Oct 8, 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.
Fixes #209.
TableGateway::delete(),insert()andupdate()raised aTypeErrorfor an aliased table.Sqlpassed the aliased array to theDelete,InsertandUpdateconstructors, which only acceptedstring|TableIdentifier|null, and rendering an aliased array failed inAbstractSql::resolveTable().Changes
Delete,InsertandUpdateconstructors accept an aliased table array, as theirfrom(),into()andtable()setters already do.AbstractPreparableSql::unaliasTable()returns the bare table, and data-changing statements render it without the alias, since alias syntax in INSERT, UPDATE and DELETE is not portable.getRawState('table')still returns the array, soTableGateway's swap-and-restore keeps working.TableGatewaytest drivesdelete(),insert()andupdate()through a realSqlandAdapterand checks the SQL that reaches the driver.DeleteTest,InsertTest,UpdateTestandSqlTestcover the aliased forms.Breaking changes
None.
mago format,mago lint,mago analyzeand the unit tests pass.