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

Repeat scalar function panics on negative repeat counts. #10759

Closed
tshauck opened this issue Jun 2, 2024 · 0 comments · Fixed by #10760
Closed

Repeat scalar function panics on negative repeat counts. #10759

tshauck opened this issue Jun 2, 2024 · 0 comments · Fixed by #10760
Labels
bug Something isn't working

Comments

@tshauck
Copy link
Contributor

tshauck commented Jun 2, 2024

Describe the bug

The repeat scalar function currently panics causing a capacity overflow error for negative numbers.

To Reproduce

SELECT repeat('hi', -1)
thread 'main' panicked at library/alloc/src/slice.rs:503:50:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior

Postgres and Spark both appear to return empty strings when presented with a negative number.


postgres=# SELECT LENGTH(repeat('hi', -1));
 length 
--------
      0
(1 row)

Additional context

No response

@tshauck tshauck added the bug Something isn't working label Jun 2, 2024
@tshauck tshauck changed the title r Repeat scalar function panics on negative repeat counts. Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant