Databases 10 min read

What New SQL Features Did SQLite Add in 2018? A Deep Dive

This article reviews the SQLite SQL enhancements introduced between versions 3.22.0 and 3.26.0, covering boolean literals, window functions, the FILTER clause, upsert syntax, column renaming, and related API changes, while comparing SQLite’s support to other major database systems.

Open Source Linux
Open Source Linux
Open Source Linux
What New SQL Features Did SQLite Add in 2018? A Deep Dive

SQLite is often underestimated, but it is a reliable, file‑based database capable of handling terabyte‑scale data without a network layer. The article examines the SQL features added to SQLite during 2018 (versions 3.22.0 – 3.26.0).

New SQL Features in 2018

Boolean literals and predicates

Window functions

FILTER clause

INSERT … ON CONFLICT ("Upsert")

Rename column

Other minor updates

Boolean Literals and Predicates

Since version 3.23.0 SQLite treats the keywords true and false as integers 1 and 0. It also supports IS [NOT] TRUE|FALSE predicates, while the UNKNOWN keyword is no longer available; NULL should be used instead.

Example comparisons: WHERE c <> FALSE versus WHERE c IS NOT FALSE The first expression excludes rows where c is NULL, whereas the second includes them because NULL IS NOT FALSE evaluates to true.

Boolean support summary
Boolean support summary

Window Functions

SQLite 3.25.0 introduced window functions, aligning its OVER clause support with most other databases. The only notable limitation is that the RANGE frame cannot use numeric or interval offsets—only CURRENT ROW and UNBOUNDED PRECEDING/FOLLOWING are allowed.

Window function support
Window function support

FILTER Clause

The FILTER clause acts as a suffix to aggregate functions, allowing rows to be excluded before aggregation. SQLite supports FILTER with OVER aggregates starting from 3.25.0, but not with GROUP BY aggregates, so a CASE expression is still required for those cases.

SELECT SUM(revenue) total_revenue,
       SUM(CASE WHEN product = 1 THEN revenue END) prod1_revenue
FROM sales;

can be written as

SELECT SUM(revenue) total_revenue,
       SUM(revenue) FILTER (WHERE product = 1) prod1_revenue
FROM sales;
FILTER clause illustration
FILTER clause illustration

INSERT … ON CONFLICT (Upsert)

Starting with version 3.24.0 SQLite added the upsert syntax, enabling graceful handling of primary‑key or unique‑constraint conflicts. The syntax mirrors PostgreSQL’s ON CONFLICT clause.

INSERT INTO target
SELECT * FROM source
ON CONFLICT (id) DO UPDATE SET val = excluded.val;

Because the parser may confuse the ON keyword, a harmless WHERE TRUE clause can be inserted before the conflict clause.

INSERT INTO target
SELECT * FROM source
WHERE TRUE
ON CONFLICT (id) DO UPDATE SET val = excluded.val;
Upsert syntax example
Upsert syntax example

Rename Column

SQLite also introduced a non‑standard ALTER TABLE … RENAME COLUMN … TO … statement, allowing column names to be changed directly.

ALTER TABLE my_table RENAME COLUMN old_name TO new_name;
Rename column syntax
Rename column syntax

Other 2018 Updates

Beyond SQL syntax, SQLite released several API changes in 2018. Detailed release notes are available on the official SQLite news page.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

sqldatabaseSQLitebooleanwindow-functionsUpsertFILTER clause
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.