Skip to content
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

Escape column names and paths in order by clause with backticks #38645

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

ifeelgood
Copy link

@ifeelgood ifeelgood commented Feb 7, 2024

This change includes previous escaping implementation as well as handles sorting by embedded columns which was the reason for the issue reopening.
Sort.disableEscaping() method was introduced to give a simple workaround to the users who face any other future regression issues.
An integration test was added to replicate and cover #38521

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I'll let @FroMage give his opinion on the disableEscaping() method, if any.

Copy link

quarkus-bot bot commented Feb 8, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit f0a3d74.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging-kafka/deployment

io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase.sseStream - History

  • Assertion condition Expecting size of: [] to be greater than or equal to 2 but was 0 within 10 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: 
Assertion condition 
Expecting size of:
  []
to be greater than or equal to 2 but was 0 within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!


private static StringBuilder escapeColumnName(String columnName) {
StringBuilder sb = new StringBuilder();
String[] path = columnName.split("\\.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have dots in property names? I assume not. I'm asking because if there's a way to escape dots like \. in column names, then we'd have to respect that, but I don't think column names support dot escaping.

I just cheked the HQL grammar and there are no escaped dots, so we're good.

@FroMage FroMage merged commit 8012cf5 into quarkusio:main Feb 9, 2024
39 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panache - Sort properties injected in the query should be escaped somehow
3 participants