title: What happens when MySQL adds a function with the same name as your own?
body: <p>I use sha3 hashes in php (7.2) and I was going to continue using them in MySQL, but MySQL doesn't have support for them yet. </p>
  
  <p>If I write my own UDF and call it, say, <code>sha3</code>, but then some future MySQL version adds a native <code>sha3</code> function, what happens?</p>
  
  <p>I'll probably name it something else anyway to avoid the possible conflict, but this could happen with any function eventually, so I'm certainly curious.</p>
  
  <hr>
  
  <p>Just in case anyone is looking for sha3 support in MySQL, I have written a MySQL UDF that does exactly that using rhash that intends to function <em>exactly</em> like the native sha2 function, which you can download here (installation and usage instructions are in the comments) <a href="https://gist.github.com/BrianLeishman/a0f40e7a0a87a7069c5c56a768ff3179" rel="nofollow noreferrer">https://gist.github.com/BrianLeishman/a0f40e7a0a87a7069c5c56a768ff3179</a></p>
  
  <p>Also, it's worth noting that sha3 is supposed to be faster than sha2 (I think), but my function is 4x as slow as native sha2 (when generating 100,000 hashes), but hopefully the future native sha3 will solve that issue.</p>
  
  <hr>
  
  <p>I've added a separate UDF for returning the hashes without hex encoding called <code>unhex_sha3</code>, which is should literally act as <code>unhex(sha3(...</code>, and this version is almost exactly native speed (compared to <code>sha2</code>), since I can avoid the pointless translation between hex encoding and back.</p>
  
  <p><a href="https://gist.github.com/BrianLeishman/d7903a4acba75707c05fc581e1c714c3" rel="nofollow noreferrer">https://gist.github.com/BrianLeishman/d7903a4acba75707c05fc581e1c714c3</a></p>