Skip to content

Postgres specific implementation of ROUND()#6789

Merged
labkey-matthewb merged 2 commits intorelease25.3-SNAPSHOTfrom
25.3_fb_postgres_is_special
Jun 25, 2025
Merged

Postgres specific implementation of ROUND()#6789
labkey-matthewb merged 2 commits intorelease25.3-SNAPSHOTfrom
25.3_fb_postgres_is_special

Conversation

@labkey-matthewb
Copy link
Copy Markdown
Contributor

Rationale

Postgres does not support ROUND(double) use explicit cast to NUMERIC(unspecified) as a work around.

Related Pull Requests

Changes

Copy link
Copy Markdown
Contributor

@labkey-adam labkey-adam left a comment

Choose a reason for hiding this comment

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

Some suggestions in my comments

else if (dialect.isPostgreSQL())
{
/* fall through */
// Postgres ROUND() requires NUMERIC argument and will error with DOUBLE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move/update/consolidate the comment above (lines #829 - 831) into this comment?

}
else
{
int n = Integer.MIN_VALUE;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe PostgreSQL is the only dialect that doesn't support round double, so we should never get to this case. We could remove this block or at least add a comment. We could also default supportsRoundDouble() to return true to make it more obvious that PostgreSQL is the only exception.

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.

Added comment.

labkeyMethod.put("round", new Method("round", JdbcType.DOUBLE, 1, 2)
{
@Override
@Override
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Weird spacing

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.

Lots of TAB chars in this file. Can address in develop.

@labkey-matthewb labkey-matthewb merged commit 6f4b3ff into release25.3-SNAPSHOT Jun 25, 2025
10 checks passed
@labkey-matthewb labkey-matthewb deleted the 25.3_fb_postgres_is_special branch June 25, 2025 15:57
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