Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 30, 2025

Thank you for the time you are putting into AlaSQL!

The REPLACE function was throwing an error when passed numeric values instead of converting them to strings like MySQL/SQLite do.

Changes:

  • Modified stdfn.REPLACE in src/55functions.js to call .toString() on all three parameters (target, pattern, replacement)
  • Rewrote test/test1455.js with proper test coverage for numeric handling

Example:

-- Both now return '1_3' (matching MySQL/SQLite behavior)
SELECT REPLACE('123', '2', '_')
SELECT REPLACE(123, '2', '_')

-- Numbers work in pattern and replacement too
SELECT REPLACE(123, 2, 9)  -- returns '193'

#1455


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ests

Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 30, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • upload.wikimedia.org
    • Triggering command: /usr/local/bin/node /usr/local/bin/node node_modules/mocha/bin/mocha.js ./test --reporter dot --bail (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix replace function Fix REPLACE function to handle numbers like MySQL/SQLite Nov 30, 2025
Copilot finished work on behalf of mathiasrw November 30, 2025 12:18
Copilot AI requested a review from mathiasrw November 30, 2025 12:18
@mathiasrw mathiasrw marked this pull request as ready for review November 30, 2025 12:19
@mathiasrw mathiasrw merged commit a981630 into cohelp/NmN03jain/1774 Nov 30, 2025
2 checks passed
@mathiasrw mathiasrw deleted the copilot/sub-pr-2282 branch November 30, 2025 12:21
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