neSQL
PostgreSQL's grammar. NEDB's memory.
The SQL you already write — over a database that never forgets, and can prove it.
Nobody should have to learn a query language to use a database
That sentence cost us a query language.
NEDB shipped with NQL — a FROM-first language built around the things NEDB can do that nothing else can: reach any point in history, ask what was believed true as of a date, walk the causal chain that produced a record. It works. It is also a tax: before you can ask NEDB a question, you have to learn how to ask.
Meanwhile the engine grew a PostgreSQL wire-protocol endpoint, and the SQL arriving on it
was translated into NQL by string surgery. That is where every interesting bug lived.
A qualified column (WHERE orders.status = 'paid') was rewritten by hand and silently
matched nothing. HAVING n > 1 passed through verbatim and answered zero rows. total * 2
became a field name nothing was called, so the column came back blank. Not one of those
was an engine bug. Every one was a translation bug.
And translation had a ceiling it could never clear. NQL's grouped row carries the group key,
count, and exactly one named aggregate — so SELECT sum(total), avg(total) GROUP BY status
was not slow or degraded, it was unrepresentable. No amount of cleverness in the translator
fixes a row model.
So we stopped translating.
What neSQL is
PostgreSQL's real grammar — gram.y, all 19,513 lines and 492 keywords of it, vendored from
PostgreSQL 17.4 with its copyright notice intact — extended with the handful of clauses
NEDB needs to say what it can actually do.
vendor/postgresql/
gram.y 19,513 lines the real parser, unmodified upstream
kwlist.h 492 keywords
system_views.sql 1,377 lines pg_catalog, Postgres's own definitions
information_schema.sql 3,046 lines the standard catalogue, verbatim
COPYRIGHT 23 lines permissive; modification expressly granted
We are not reimplementing SQL from memory. We are starting from the definition every other tool in the world was built against, and adding to it — the same road CockroachDB, Materialize and RisingWave all took.
The clauses we add, and why
PostgreSQL's grammar contains no temporal SQL — we checked, and SYSTEM_TIME,
PERIOD and PORTION appear exactly zero times in gram.y. Time travel was never
going to arrive for free. So it arrives deliberately:
| neSQL | what it answers | precedent |
|---|---|---|
AS OF SYSTEM TIME <seq> |
the exact state at a point in history | CockroachDB |
VALID AS OF <time> |
what was believed true as of then | SQL:2011 application time |
TRACE <id> |
the causal chain that produced this record | WITH RECURSIVE |
LINK / TRAVERSE |
relationships, without a join table | graph SQL |
SEARCH |
full-text over document fields | tsquery |
_hash _seq _caused_by |
provenance, selectable like any column | — |
And what the vendored grammar hands us for free, which the old translator refused
by name: WITH RECURSIVE, window functions, GROUPING SETS, and MERGE — upsert,
which lands remarkably naturally on an append-only store.
What this means if you already speak Postgres
You are done learning.
-- ordinary SQL. nothing to look up.
SELECT status, sum(total), avg(total)
FROM orders
WHERE region = 'eu'
GROUP BY status
HAVING count(*) > 1;
-- the same query, ninety thousand writes ago
SELECT status, sum(total), avg(total)
FROM orders AS OF SYSTEM TIME 412
GROUP BY status;
-- why does this row say what it says?
TRACE 'order-8814';
The first query is the point. It is not a NEDB query. It is a query — and the audit trail underneath it is free, permanent, and hash-verified, with no triggers, no shadow tables, and no application code.
Status: pre-release, and honest about it
This repository is the grammar and the front-end, being built in the open. It is not installable yet, and the package on each registry is a reserved name, not a product. When that changes it will change here first.
| ✅ | PostgreSQL 17.4 grammar + catalogue vendored, licence intact |
| ✅ | Executor foundations shipped in nedb-engine — joins, subqueries, set operations, array_agg(x ORDER BY y), derived tables, generate_series |
| 🔨 | neSQL grammar delta — the temporal and causal clauses above |
| 🔨 | One IR: neSQL and NQL compiling to the same plan, so nothing translates |
| 🔨 | The executor pointed at user collections, not only the catalogue |
| 📋 | Cross-front-end parity assertions — the same question through both, same answer |
Today, right now, in production: the PostgreSQL endpoint in
nedb-engine already answers psql,
SQLAlchemy (Core and ORM), asyncpg and node-postgres against a live store, with
pg_catalog and information_schema implemented as genuinely queryable relations.
neSQL is where that stops needing an asterisk.
Licence
neSQL is BUSL-1.1 — free in production under USD $1M annual revenue, converting
to Apache 2.0 automatically. See LICENSE.
The vendored PostgreSQL sources under vendor/postgresql/ remain under the
PostgreSQL Licence, reproduced verbatim and unmodified at
vendor/postgresql/COPYRIGHT. Our thanks to the
PostgreSQL Global Development Group — thirty years of grammar we did not have to
guess at.
© INTERCHAINED LLC · built with Vex (Claude Opus 5)
Interchained builds tools that outlive the demo.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nesql-0.0.1.tar.gz.
File metadata
- Download URL: nesql-0.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7a3cce63e41e66fe721ef68d517d7fc738f898424f1d2255e2c733cb2540d32
|
|
| MD5 |
d827b5097f818fc23c9050ef3da90a20
|
|
| BLAKE2b-256 |
202c4cfd17cb825b3d85405607f5f7fd423c67616e1b8c377ff8ba0e8e827c48
|
File details
Details for the file nesql-0.0.1-py3-none-any.whl.
File metadata
- Download URL: nesql-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b2a32a4f5dc37cede7c1d5699e32859cf7a8d9683b7428a2a15a35d84a0c13
|
|
| MD5 |
db49889ef278a79749f0f5c037c64b04
|
|
| BLAKE2b-256 |
4a2ea5f6ffa19c75ceea7be3118cf9bc5c8d4d2fbfa2887e8fd624f65e4691e5
|