ch.islandsql:islandsql

Parser for grammars in SQL files


License
Apache-2.0

Documentation

IslandSQL

Introduction

IslandSQL is an ANTLR 4 based parser for grammars used in SQL files. The parser requires a Java Virtual Machine supporting version 8 or newer and is available on Maven Central.

Scope

Database Management Systems

The following table shows the DBMS and their grammar versions in scope:

DBMS Grammar Version HTML Reference (live) PDF Reference (snapshot)
OracleDB SQL*Plus 23ai F47057-07 (23.4) User's Guide and Reference PDF
SQLcl 24.2 G10284-02 Users's Guide PDF
SQL 23ai F47038-15 (23.4) Language Reference PDF
PL/SQL 23ai F46753-06 (23.4) Language Reference PDF
PostgreSQL psql 16.3 psql — PostgreSQL interactive terminal PDF
SQL 16.3 SQL Commands PDF
PL/pgSQL 16.3 PL/pgSQL — SQL Procedural Language PDF

The HTML reference shows the latest version of the document. However, the latest snapshot version in PDF format represents the version that was used to define the grammar.

Statements

The IslandSQL grammar covers statements that can contain static DML statements and code in PL/SQL and PL/pgSQL.

The current islands of interests are:

Type Statement OracleDB PostgreSQL
DDL create function ✅ ✅
create json relational duality view ✅ n/a
create materialized view ✅ ✅
create package ✅ n/a
create package body ✅ n/a
create procedure ✅ ✅
create table ✅ ✅
create trigger ✅ ✅
create type ✅ ✅
create type body ✅ n/a
create view ✅ ✅
DML call ✅ ✅
delete ✅ ✅
explain plan ✅ ✅
insert ✅ ✅
lock table ✅ ✅
merge ✅ ✅
select ✅ ✅
update ✅ ✅
TCL begin n/a ✅
commit ✅ ✅
rollback ✅ ✅
savepoint ✅ ✅
set constraints ✅ ✅
set transaction ✅ ✅
other anonymous PL/SQL block ✅ n/a
do n/a ✅

Tokens that are not part of the statements listed above are preserved as hidden tokens. As a result, the token stream represents the complete input (file).

Statements containing other languages such as Java or JavaScript are not within the scope of IslandSQL, as the source code in these languages is most likely developed, linted, tested and packaged outside the database before being deployed in the database.

IslandSQL Grammar

The syntax diagrams of the IslandSQL grammar are produced by RR and can be found here.

IslandSQL file

Frequently Asked Questions (FAQ)

See FAQ.

License

IslandSQL is licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.