Village SQL - A MySQL Fork With Easy Extensions
I was happy to see a new MySQL fork appear. Village SQL bills itself as 'A drop-in replacement for MySQL with extensions for the agentic AI era'. Mainstream Oracle MySQL does have Plug-ins, but I have found them less easy to develop and use than other implementations, such as PostgreSQL extensions. So how does it work?
Head over to https://github.com/villagesql/villagesql-server and follow the directions to clone and build the code. You will see detailed instructions for Linux and Mac builds. I followed the directions, let the make run overnight (slow hampsters in my testbed Ubuntu laptop).
The instructions were complete and easy to follow.
First Run
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.6-villagesql0.0.1-dev Source distribution
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \s
--------------
/home/stoker/build/villagesql/bin/mysql Ver 8.4.6-villagesql0.0.1-dev for Linux on x86_64 (Source distribution)
Connection id: 10
Current database:
Current user: root@localhost
SSL: Cipher in use is TLS_AES_128_GCM_SHA256
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.4.6-villagesql0.0.1-dev Source distribution
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 3306
Binary data as: Hexadecimal
Uptime: 1 min 20 sec
Threads: 2 Questions: 6 Slow queries: 0 Opens: 159 Flush tables: 4 Open tables: 59 Queries per second avg: 0.075
--------------
mysql>
Load Extension
mysql> SELECT extension_name, extension_version
FROM INFORMATION_SCHEMA.EXTENSIONS;
mysql> INSTALL EXTENSION vsql_complex;
Query OK, 0 rows affected (0.02 sec)
mysql> SELECT extension_name, extension_version FROM INFORMATION_SCHEMA.EXTENSIONS;
+----------------+-------------------+
| EXTENSION_NAME | EXTENSION_VERSION |
+----------------+-------------------+
| vsql_complex | 0.0.1 |
+----------------+-------------------+
1 row in set (0.00 sec)
mysql>
-- Create a database and use it
CREATE DATABASE demo;
USE demo;
-- Create a table using the new COMPLEX type
CREATE TABLE electronic_components (
id INT PRIMARY KEY,
name VARCHAR(50),
impedance COMPLEX
);
-- Insert complex number values (using string literals)
INSERT INTO electronic_components VALUES
(1, 'Resistor', '(100,0)'),
(2, 'Inductor', '(0,50)'),
(3, 'Capacitor', '(25,-75)');
-- Query the data
SELECT * FROM electronic_components;
-- Use extension functions (note: functions require extension prefix)
SELECT
name,
impedance,
vsql_complex.complex_abs(impedance) AS magnitude,
vsql_complex.complex_real(impedance) AS resistance,
vsql_complex.complex_imag(impedance) AS reactance
FROM electronic_components;
mysql> SELECT
-> name,
-> impedance,
-> vsql_complex.complex_abs(impedance) AS magnitude,
-> vsql_complex.complex_real(impedance) AS resistance,
-> vsql_complex.complex_imag(impedance) AS reactance
-> FROM electronic_components;
+-----------+-----------+-------------------+------------+-----------+
| name | impedance | magnitude | resistance | reactance |
+-----------+-----------+-------------------+------------+-----------+
| Resistor | (100,0) | 100 | 100 | 0 |
| Inductor | (0,50) | 50 | 0 | 50 |
| Capacitor | (25,-75) | 79.05694150420949 | 25 | -75 |
+-----------+-----------+-------------------+------------+-----------+
3 rows in set (0.01 sec)
mysql>
Comments
Post a Comment