Skip to content

Rename native functions#27

Open
ngaro wants to merge 1 commit into
infusion:masterfrom
ngaro:nonative
Open

Rename native functions#27
ngaro wants to merge 1 commit into
infusion:masterfrom
ngaro:nonative

Conversation

@ngaro
Copy link
Copy Markdown

@ngaro ngaro commented Jul 6, 2020

On newer versions of MySQL and MariaDB there are native functions that clash with udf_infusion defined functions.
The following renames where necessary to solve this:

  • median() is now med()
  • percentile_cont() is now percentile_contin()
  • percentile_disc() is now percentile_discr()

@ngaro
Copy link
Copy Markdown
Author

ngaro commented Jul 7, 2020

I just tested it with MySQL version 8.0.20. It doesn't seem to be a issue there. They are only native functions in MariaDB.

If renaming the functions is too big of a change then i would suggest creating a extra branch mariadb (and i'll change this pull request to that branch)

@vlabella
Copy link
Copy Markdown

vlabella commented Nov 4, 2024

did the mariadb branch ever get created to solve this issue?

@dreibh
Copy link
Copy Markdown

dreibh commented Mar 10, 2026

The pull request is working fine with MariaDB 11.5. I am wondering whether this fix is to be merged into upstream, since this pull request is now open for almost 6 years. udf_infusion is not working with MariaDB from at least version 10.11 (I did not test earlier versions), due to the function naming conflict.

Alternatively, if renaming is unwanted for MySQL usage (I did not test with MySQL), a build-time option for ./configure could be used to optionally allow for renaming the three functions using #ifdef's.

If naming of the functions is a concern, may be using a prefix like "agg_" for udf_infusion's functions would make the defined aggregate functions easy to distinguish from the build-in MariaDB window functions median(), percentile_cont(), percentile_disc().

@dreibh
Copy link
Copy Markdown

dreibh commented Mar 10, 2026

For reference, this is the work-around to apply the pull request to up-to-date udf_infusion, which works with MariaDB 11.5:

git clone https://github.com/infusion/udf_infusion.git
cd udf_infusion
git remote add ngaro https://github.com/ngaro/udf_infusion.git
git fetch --all
git merge ngaro/nonative
./configure
make
sudo make install
mariadb [OPTIONS_HERE ...] < load.sql

@vlabella
Copy link
Copy Markdown

vlabella commented Mar 10, 2026

what about adding a tag "udf_" or "udf_infusion" or "udf_i" to ALL the functions such as
udf_round, udf_cround, ...

This would prevent future clashes and effectively creates a namespace for these extra routines.

This would break current code - but could be turned off with an option in configure --no_tag.

@dreibh
Copy link
Copy Markdown

dreibh commented Mar 11, 2026

Yes, this sounds very reasonable.

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.

4 participants