Install VillageSQL extensions to add custom types, functions, and capabilities to your database.
Command Syntax
INSTALL EXTENSION extension_name;
Extensions are distributed as .veb (VillageSQL Extension Bundle) files containing compiled libraries and metadata.
Extension Naming Conventions
VillageSQL uses different naming conventions in different contexts:
- SQL commands: Use underscores:
INSTALL EXTENSION vsql_uuid
- Repository names: Use hyphens:
github.com/villagesql/vsql-uuid
- File names: Use underscores:
vsql_uuid.veb
- manifest.json: Use underscores to match SQL:
"name": "vsql_uuid"
Example:
# Clone from GitHub repo (hyphens in URL)
git clone https://github.com/villagesql/vsql-uuid
# But .veb file uses underscores
ls vsql_uuid.veb
# Install with underscores (no quotes)
INSTALL EXTENSION vsql_uuid;
Prerequisites
- Running VillageSQL Server instance
- Administrative access (root or equivalent)
- Extension
.veb file in veb_dir (check with SHOW VARIABLES LIKE 'veb_dir';)
Installing Built-in Extensions
Built-in extensions included with VillageSQL are already in the veb_dir. Simply enable them:
-- Connect to VillageSQL
mysql -u root -p
-- Install the extension
INSTALL EXTENSION vsql_complex;
Verify Installation
-- List installed extensions
SELECT * FROM INFORMATION_SCHEMA.EXTENSIONS;
Output:
+------------------+-------------------+
| EXTENSION_NAME | EXTENSION_VERSION |
+------------------+-------------------+
| vsql_complex | 0.0.1 |
+------------------+-------------------+
Test Functionality
-- Create a database first
CREATE DATABASE test_db;
USE test_db;
-- Test extension functions
CREATE TABLE test (id INT, value COMPLEX);
INSERT INTO test VALUES (1, '(3,4)');
SELECT complex_abs(value) FROM test; -- Returns 5.0
-- Clean up
DROP TABLE test;
DROP DATABASE test_db;
Installing External Extensions
For extensions downloaded or built separately:
1. Find VEF Directory
SHOW VARIABLES LIKE 'veb_dir';
2. Copy Extension File
# Copy .veb file to veb_dir
sudo cp my-extension.veb /path/to/veb_dir/
# Verify file exists
ls -l /path/to/veb_dir/*.veb
3. Install Extension
INSTALL EXTENSION my_extension;
4. Verify Installation
SELECT * FROM INFORMATION_SCHEMA.EXTENSIONS WHERE EXTENSION_NAME = 'my_extension';
Troubleshooting
| Issue | Solution |
|---|
Extension not found | Verify .veb file is in veb_dir with correct name |
Permission denied | Check file permissions: chmod 644 extension.veb |
For more troubleshooting, see Managing Extensions.
Next Steps