Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dbeaver/dbeaver#40639 Quote alias to prevent it's treated as keyword in query#41007

Open
HellAmbro wants to merge 3 commits intodbeaver:develdbeaver/dbeaver:develfrom
HellAmbro:dbeaver/dbeaver#40639HellAmbro/dbeaver:dbeaver/dbeaver#40639Copy head branch name to clipboard
Open

dbeaver/dbeaver#40639 Quote alias to prevent it's treated as keyword in query#41007
HellAmbro wants to merge 3 commits intodbeaver:develdbeaver/dbeaver:develfrom
HellAmbro:dbeaver/dbeaver#40639HellAmbro/dbeaver:dbeaver/dbeaver#40639Copy head branch name to clipboard

Conversation

@HellAmbro
Copy link
Copy Markdown
Contributor

Closes #40639

Screenshot 2026-05-05 195702

SelectItem<?> sei = new SelectItem<>(expression);
if (useAliasForColumns) {
sei.setAlias(new Alias(funcAliases[i]));
sei.setAlias(new Alias(SQLUtils.quoteString(dataSource, funcAliases[i])));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's weird. We generate this alias, and we can generate an alias that does not match a keyword.
I believe we need to modify the makeGroupFunctionAlias method so it generates a non-conflicting alias name. Take a look at generateEntityAlias (SQLUtils:824) method for the example implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi, thanks for the review. Your advice was very helpful. I know it was a straightforward solution, both for keeping the column named COUNT and for treating potential keywords as identifiers. However, I modified the makeGroupFunctionAlias method as suggested; now, when an alias is a keyword, a suffix is added. I tried to keep everything as close to the original code with minimal changes. I think there’s still space for improvement. I’ve also attached a screenshot to see the result.
Immagine 2026-05-06 173429

E1izabeth
E1izabeth previously approved these changes May 6, 2026
Copy link
Copy Markdown
Member

@E1izabeth E1izabeth left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Copy Markdown
Member

@ShadelessFox ShadelessFox left a comment

Choose a reason for hiding this comment

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

I can't do a proper review because GitHub is lagging again.

Please move the isAliasReservedWord statement within if (!alias.isEmpty()) {.

@HellAmbro
Copy link
Copy Markdown
Contributor Author

@ShadelessFox thanks. I forgot to move it inside the if statement.

@ShadelessFox
Copy link
Copy Markdown
Member

Thanks. Passing to QA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

firebirdDB - at groping panel query, "count" is special word. use another word to fix error.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.