PostgreSQL / MySQL wire protocol
FileDB implements the binary PostgreSQL v3 and MySQL wire protocols — change the port in your connection string and your app talks to FileDB as if it were real PostgreSQL/MySQL: psql, mysql, psycopg2/libpq, mysql-connector, JDBC, and so on connect directly.
Enabling it
./filedb -data ./databases -pg-addr :5432 -mysql-addr :3306
psql "host=127.0.0.1 port=5432 user=alice dbname=shop sslmode=disable"
mysql -h 127.0.0.1 -P 3306 -u alice -p shop
Both ports operate on the same set of .fdb files: a write through MySQL is readable through PostgreSQL and vice versa.
Verified against real clients
CREATE TABLE (SERIAL/AUTO_INCREMENT), single and multi-row INSERT, INSERT … RETURNING, SELECT with WHERE/ORDER BY/COUNT(*), parameterized queries, version()/VERSION(), password + role authentication. Numeric columns arrive to the driver as int/float, not strings; text with leading zeros ('00123') stays a string without loss.
Dialect-accurate string escaping
String literals are decoded with the semantics of the protocol the query arrived on: PostgreSQL — only '' → ', backslash is a plain character; MySQL — the full set of backslash escapes (for quotes, newline, tab, null, backspace, etc.) plus ''. Since v2.44 this is guaranteed to be consistent between single- and multi-row INSERT ... VALUES (...), (...) and for literals inside ON DUPLICATE KEY UPDATE — before that, a multi-row INSERT over the MySQL protocol could lose escaping backslashes.
Wire-layer limitations
- No TLS —
SSLRequestis refused, the connection continues unencrypted. Usesslmode=disableplus a tunnel/VPN/trusted network. - Prepared statements over the binary protocol are handled, but results come back in text form.
- Only the SQL subset the engine understands is supported — e.g. a bare
SELECT 1withoutFROMandINSERT … DEFAULT VALUESaren't implemented.
Authentication
Uses the same user model as HTTP (see the RBAC page). MySQL supports mysql_native_password with no extra client flags; older accounts without an mysql_native field authenticate via mysql_clear_password (the client must allow the plugin: mysql --enable-cleartext-plugin).