-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aliases with period separator are disregarded #1103
Comments
In SQL, the alias character is accepted And there's no need to use the alias for your case. You can refer to the column directly with |
@catfan, thank you for your input. The fundamental problem at hand pertains to the construction of query strings within a Filter/Pagination/Search implementation, specifically concerning the utilization of an underscore ( Notably, underscores are commonly employed in table naming conventions across various frameworks and CMSs, such as WordPress, Laravel, and Joomla. This widespread use presents a challenge: employing underscores as alias delimiters in our context is problematic. Implementing a find-and-replace operation based on underscores becomes ineffective due to this naming convention. Technical Illustration
Proposed SolutionA potential resolution is to adopt a distinct character, such as a period ( @catfan, in light of your remarks on permissible characters for aliases, which also apply to table and column names, a strategic decision may be necessary. This decision would involve either forgoing the use of underscores in table and column names, reserving them exclusively for alias demarcation, or adopting an alternative delimiter strategy to maintain clarity in query string construction. Any input you have would be greatly appreciated. I can send you the BASE MODEL and the TEST MODEL that this is being utilized in if you'd be willing to review them. |
@webmdt Thanks for the sample. I need to test more databases for this case and check out what alias characters can be accepted. However, to avoid the name conflict, the best practice is to adopt different naming styles for the table and the column, or any way that can return different strings. It's up to the developer because as a database framework, it cannot check the name conflict problem. Also, if you want to allow the alias to accept the period |
Version - 2.1.10
Having an issue where the aliases are being removed if using a period separator. For any other separator, the aliases stay intact.
Example:
test.id (test.id)
will output
id
test.id (test_id)
will output
test_id
Output QUERY:
SELECT
test.
id,
test.
join_id,
test.
amount,
test.
title,
test.
status,
test.
username,
test.
created,
test.
createdBy,
test.
deleted,
test.
deletedBy,
test.
updated,
test.
updatedByFROM
testORDER BY
test.
idDESC LIMIT 10 OFFSET 0
Expected Output:
The text was updated successfully, but these errors were encountered: