Developer beta 0.1.0-beta.1 documentation. The build is not available for download yet; these pages describe the beta as built and tested on Linux x86-64.
PostgreSQL compatibility
holadb serve <dir> --pg 127.0.0.1:5433 adds a PostgreSQL wire-protocol
(v3) endpoint. psql, libpq and drivers built on it (psycopg, pgx, JDBC,
node-postgres, …) connect to it as if it were a PostgreSQL server; the SQL
they send is HolaDB’s SQL subset.
psql postgresql://app@127.0.0.1:5433/holadb
PGPASSWORD=secret psql -h 127.0.0.1 -p 5433 -U app -d holadb -c "SELECT count(*) FROM users"
Supported
- Startup,
SSLRequest(answered withSand upgraded when the server has--tls-cert/--tls-key,Notherwise;--require-tlsrefuses a plaintext startup with28000),CancelRequest(ignored). - Authentication: none while the database has no users; SCRAM-SHA-256
(SASL) once it has, exactly as psql and libpq drivers expect
(
PGPASSWORD,.pgpass, the password prompt); over TLSSCRAM-SHA-256-PLUSwithtls-server-end-pointchannel binding is offered first and psql uses it. The user name comes from the startup message. Authentication is re-checked on every message: a session from before the first user, or of a user since dropped, ends with28000; a changed role set applies at the next statement; a statement the user may not run is refused atParsewith42501. Failed logins back the client address off (28000“too many failed logins” inside the window). - Limits:
--max-connections(53300when full),--statement-timeout-ms(57014), startup packets over 10 000 bytes and pre-authentication messages over 64 KiB are refused. - The parameter statuses clients look for (
server_version,client_encoding,DateStyle,TimeZone,integer_datetimes,standard_conforming_strings, …). - The simple query protocol, including multi-statement scripts; the
extended protocol (Parse / Bind / Describe / Execute / Sync / Close /
Flush) with text parameters and binary parameters for the fixed-width
types;
RowDescriptionwith PostgreSQL type OIDs; text-format results;CommandCompletetags;ErrorResponsewith SQLSTATE codes and error positions; transaction status inReadyForQuery. SET/RESETof session settings a driver sends (client_encoding,DateStyle,application_name, …): accepted, with no effect. The isolation level is not such a setting:SET TRANSACTION ISOLATION LEVEL READ COMMITTEDis accepted because that is the level HolaDB has; any other level (SERIALIZABLE,REPEATABLE READ, also throughdefault_transaction_isolation) is refused with0A000, so that a client is never told it has a guarantee it does not have.SHOW server_version,SHOW transaction_isolationand a few other parameters,SELECT version().- Transactions with the PostgreSQL semantics (a failed statement aborts the
transaction until
ROLLBACK).
Not supported (refused with a clear error, never faked)
COPY; thepg_catalog/information_schematables, so psql’s\d,\dtand ORM introspection do not work — useSHOW TABLES/SHOW COLUMNS FROM t;DECLARE CURSOR; portals with a row limit (Executewith a maximum returns everything); binary result formats;LISTEN/NOTIFY; multiple databases (the database name in the URL is ignored); and every SQL construct outside the subset (JOIN, subqueries,GROUP BY, …).
Type mapping on the wire
| HolaDB | PostgreSQL type sent to clients |
|---|---|
| BOOLEAN | bool |
| TINYINT, SMALLINT | int2 |
| INTEGER, UTINYINT, USMALLINT | int4 |
| BIGINT, UINTEGER | int8 |
| UBIGINT | numeric (a 64-bit unsigned value may exceed int8) |
| REAL | float4 |
| DOUBLE PRECISION | float8 |
| TEXT | text |
| BYTEA | bytea (\x hex) |
| TIMESTAMP | timestamp (YYYY-MM-DD HH:MM:SS.ffffff) |
| JSON | json |
Security note
Without --tls-* the endpoint is plaintext: bind it to 127.0.0.1 or a
trusted network. With TLS, use sslmode=verify-full and sslrootcert
(or a publicly trusted certificate) so the client checks the server;
--require-tls on the server stops any client from connecting in clear.
Passwords are never sent in clear: SCRAM proves possession of the
password without transmitting it, and over TLS the proof is bound to the
server certificate.