Skip to content

Conversation

@waketzheng
Copy link
Contributor

Fixes #15


def get_function_sql(self, ctx: SqlContext) -> str:
if ctx.dialect == Dialects.MSSQL:
self.name = "POWER"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a hell of a side effect when get_function_sql changes the object state. You don't expect a getter to change the state.

I think we can make name a function accepting SqlContext in Function, and then override it in Pow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can make name a function accepting SqlContext in Function, and then override it in Pow.

It seems hard to do that, so I use a new func get_dialect_special_name

Copy link
Contributor

@henadzit henadzit 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 for addressing the feedback!

@waketzheng waketzheng merged commit 268a169 into tortoise:main Jun 15, 2025
5 checks passed
@waketzheng waketzheng deleted the fix-15-mssql-power-func branch June 16, 2025 08:04
@waketzheng waketzheng mentioned this pull request Jun 26, 2025
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.

** (power) does not get translated to POWER in MSSQL

2 participants