GSoC
Google Summer of Code 2025 – Work Report
Contributor: Alex Jia Project: SQLancer – PostgreSQL Testing Enhancements Organization: SQLancer Project
Overview
My GSoC 2025 project focused on extending SQLancer’s PostgreSQL module to better support features introduced in PostgreSQL versions 13 through 16. The work ranged from analyzing version-specific grammar changes to implementing support for newly introduced SQL constructs such as MERGE, new CTE functions, and updates to EXTRACT.
Contributions
PostgreSQL 13
For PostgreSQL 13, I performed a detailed analysis of new SQL features and their relevance to SQLancer’s grammar. Most of the constructs introduced in this version are not yet supported in SQLancer’s base grammar and were therefore marked as not applicable for implementation in this cycle. Examples include:
ALTER NO DEPENDS ONALTER STATISTICS SET STATISTICSALTER TYPEALTER VIEW RENAME COLUMNCREATE DATABASE WITH LOCALECREATE TABLESPACEDROP DATABASE FORCEEXPLAIN ANALYSEROWSELECT WITH TIES
Additionally, I confirmed that certain changes required no modification in SQLancer, such as:
ALTER TABLE SET STORAGECREATE INDEX deduplication
This gave SQLancer maintainers a clear mapping of what v13 introduced and which parts do not affect current grammar support.
PostgreSQL 14
EXTRACT function updates:
Added grammar support for the new EXTRACT fields that return numeric results.
Changed the return type of
EXTRACT()fromFLOAT8to NUMERIC, matching the PostgreSQL v14 update.
PostgreSQL 15
New CTE Function Support:
Implemented generation of the new CTE functionality introduced in v15.
Extended SQLancer’s AST to capture additional recursive/non-recursive structures.
MERGE Statement Generator:
Added a generator for the
MERGEstatement introduced in PostgreSQL 15.Supported
WHEN MATCHEDandWHEN NOT MATCHEDbranches to fuzz-test conditional updates and inserts.
PostgreSQL 16 (Partial)
Generic Plan in EXPLAIN:
Added grammar support for PostgreSQL 16’s generic plan option in
EXPLAIN.
Renaming
force_parallel_mode:Updated SQLancer references to reflect the renamed parameter in PostgreSQL 16, ensuring compatibility.
Skills and Learning Outcomes
SQL grammar evolution: Learned how to adapt SQLancer’s query generator to account for Postgres version-specific changes.
AST/grammar implementation: Implemented new constructs (
MERGE, EXTRACT numeric, CTEs) within SQLancer’s existing framework.Code quality and review: Improved maintainability and consistency through mentor feedback and iterative pull requests.
Future Work
Extend PostgreSQL 16 support further (beyond EXPLAIN and parameter renames).
Continue reviewing new Postgres versions to keep SQLancer aligned with grammar changes.
Improve documentation around version-specific features for future contributors.
Acknowledgments
I’d like to thank my mentor Robins and the SQLancer community for their detailed reviews, helpful guidance, and encouragement throughout the program.
PR Merged:
PR In Progress
Last updated