Skip to content

Enable SQLITE_ENABLE_MATH_FUNCTIONS flag in SQLite build#5262

Merged
renecannao merged 1 commit intov3.0from
v3.0-misc251220
Dec 24, 2025
Merged

Enable SQLITE_ENABLE_MATH_FUNCTIONS flag in SQLite build#5262
renecannao merged 1 commit intov3.0from
v3.0-misc251220

Conversation

@renecannao
Copy link
Contributor

Summary

Enable SQLITE_ENABLE_MATH_FUNCTIONS compile flag to provide mathematical function support in SQLite queries through ProxySQL's SQLite interface.

Changes

  • Add -DSQLITE_ENABLE_MATH_FUNCTIONS to SQLite compilation flags in deps/Makefile

Benefits

  • Enables mathematical functions (sin(), cos(), log(), pow(), sqrt(), etc.) in SQL queries
  • Enhances SQL capabilities for admin interface, query rules, and statistics
  • Minimal binary size impact (~few KB)
  • Fully backward compatible

Testing

  • Mathematical functions should work in admin SQLite interface
  • Existing functionality remains unchanged

Related Issue

Closes #5261

Checklist

  • Code changes compile successfully
  • No breaking changes introduced
  • Documentation updated if needed
  • Tests added if applicable

Add compile flag to enable mathematical functions (sin, cos, log, pow, sqrt, etc.)
in SQLite queries through ProxySQL's SQLite interface.

Issue: #5261
@gemini-code-assist
Copy link

Summary of Changes

Hello @renecannao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates advanced mathematical function support into ProxySQL's embedded SQLite by enabling a specific compilation flag. This enhancement allows users to perform complex calculations directly within their SQL queries, significantly boosting the analytical and administrative capabilities of the system. The change is designed to be seamless, ensuring full backward compatibility and a negligible increase in binary size, thereby improving functionality without introducing overhead or breaking existing features.

Highlights

  • Mathematical Functions Enabled: The SQLITE_ENABLE_MATH_FUNCTIONS compile flag has been enabled, providing support for mathematical functions like sin(), cos(), log(), pow(), and sqrt() in SQLite queries.
  • Enhanced SQL Capabilities: This change enhances SQL capabilities for the admin interface, query rules, and statistics within ProxySQL's SQLite interface.
  • Minimal Impact: The change has a minimal impact on binary size (a few KB) and is fully backward compatible.
  • Build System Update: The deps/Makefile was updated to include the new compilation flag during the SQLite build process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables mathematical functions in the embedded SQLite by adding the SQLITE_ENABLE_MATH_FUNCTIONS compilation flag. The change is straightforward and correctly implemented in deps/Makefile.

While the change itself is correct, I've noticed that no new tests have been added to verify that the mathematical functions are indeed available and working correctly after this change. I strongly recommend adding a simple test case, for example in the admin interface, that executes a query with a math function (e.g., SELECT sqrt(4)) to ensure the feature is enabled as expected.

I've also left a suggestion to improve the readability of the Makefile.

cd sqlite3/sqlite3 && patch -p0 < ../sqlite3_pass_exts.patch
cd sqlite3/sqlite3 && patch -p0 < ../throw.patch
cd sqlite3/sqlite3 && ${CC} ${MYCFLAGS} -fPIC -c -o sqlite3.o sqlite3.c -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_JSON1 -DSQLITE_DLL=1
cd sqlite3/sqlite3 && ${CC} ${MYCFLAGS} -fPIC -c -o sqlite3.o sqlite3.c -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_JSON1 -DSQLITE_DLL=1 -DSQLITE_ENABLE_MATH_FUNCTIONS

Choose a reason for hiding this comment

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

medium

For better readability and maintainability, consider breaking this long line of compilation flags into multiple lines using backslashes. This makes it easier to see all the enabled SQLite features at a glance and simplifies adding or removing flags in the future.

	cd sqlite3/sqlite3 && ${CC} ${MYCFLAGS} -fPIC -c -o sqlite3.o sqlite3.c \
		-DSQLITE_ENABLE_MEMORY_MANAGEMENT \
		-DSQLITE_ENABLE_JSON1 \
		-DSQLITE_DLL=1 \
		-DSQLITE_ENABLE_MATH_FUNCTIONS

@renecannao renecannao merged commit 4cf85d3 into v3.0 Dec 24, 2025
4 of 6 checks passed
@renecannao renecannao deleted the v3.0-misc251220 branch March 7, 2026 20:41
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.

Enable SQLITE_ENABLE_MATH_FUNCTIONS flag in SQLite build

1 participant