Skip to content

Support table name aliases in update and delete statements#24

Merged
damil merged 1 commit intodamil:masterfrom
djerius:table_alias
Jul 13, 2025
Merged

Support table name aliases in update and delete statements#24
damil merged 1 commit intodamil:masterfrom
djerius:table_alias

Conversation

@djerius
Copy link
Copy Markdown
Contributor

@djerius djerius commented Jul 13, 2025

A number of SQL databases (e.g. PostgreSQL, SQLite) support table aliases in update and delete statements. This commit adds support for this.

This will allow upstream users of SQL::Abstract::More (e.g. DBIx::Lite) to correctly support table aliases in these situations. Currently DBIx::Lite passes ->table_alias($table_name, $table_alias); as the table name to the delete and update methods, which works, fortuitously, unless quote_char is set in which the the entire "table name" which consists of e.g, "foo" AS "alias" is turned into ""foo" AS "alias"" which is rejected as incorrect SQL by the DB server.

A number of SQL databases (e.g. PostgreSQL, SQLite) support table
aliases in update and delete.
@damil damil merged commit 1ffbb21 into damil:master Jul 13, 2025
@damil
Copy link
Copy Markdown
Owner

damil commented Jul 13, 2025

Thanks for your contribution. I'll check what needs to be changed in DBIx::DataModel as well and then publish a new release of SQLAM.

@djerius
Copy link
Copy Markdown
Contributor Author

djerius commented Jul 14, 2025

Thanks. I forgot to update the documentation. Shall I do so?

@djerius djerius deleted the table_alias branch July 31, 2025 22:48
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