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

Postgres: enforce required NUMERIC type for round scalar function #34

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

sgrebnov
Copy link

@sgrebnov sgrebnov commented Sep 27, 2024

Which issue does this PR close?

PR fixes Postgres unparsing "Query Error function round(double precision, integer) does not exist" error by enforcing NUMERIC data type for round scalar function as Postgres does not support Float arguments and requires NUMERIC.

https://www.postgresql.org/docs/17/functions-math.html

round ( v numeric, s integer ) → numeric
Rounds v to s decimal places. Ties are broken by rounding away from zero.
round(42.4382, 2) → 42.44
round(1234.56, -1) → 1230

Closes spiceai/spiceai#2844

@sgrebnov sgrebnov changed the title Postgres: enforce NUMERIC data type for round scalar function Postgres: enforce required NUMERIC type for round scalar function Sep 27, 2024
@sgrebnov sgrebnov force-pushed the sgrebnov/fix-pg-round-unparsing branch from cde4135 to 9e1bd7d Compare September 27, 2024 17:18
@sgrebnov sgrebnov self-assigned this Sep 29, 2024
@sgrebnov sgrebnov marked this pull request as draft October 3, 2024 01:14
@sgrebnov sgrebnov force-pushed the sgrebnov/fix-pg-round-unparsing branch from 1d48a4a to a8f630a Compare October 3, 2024 05:46
@sgrebnov sgrebnov marked this pull request as ready for review October 3, 2024 06:02
@sgrebnov sgrebnov merged commit fabd575 into spiceai-42 Oct 3, 2024
@sgrebnov sgrebnov deleted the sgrebnov/fix-pg-round-unparsing branch October 3, 2024 07:18
sgrebnov added a commit that referenced this pull request Oct 3, 2024
…#34)

Includes initial support for dialects to override scalar functions unparsing
sgrebnov added a commit that referenced this pull request Oct 15, 2024
* Postgres: enforce required `NUMERIC` type for `round` scalar function (#34)

Includes initial support for dialects to override scalar functions unparsing

* Document scalar_function_to_sql_overrides fn
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.

3 participants