Skip to content

Features matrix

The exposed feature matrix is incomplete and grows over time.

In next tables, you will see the following legend:

  • Yes means the feature is supported, and has no specific dialect.
  • Warning means the feature is supported as standard, but some advanced forms may raise error on the RDMS side.
  • Dialect means there is a specific dialect implemented.
  • Downgrade when a less efficient with feature parity variant is used because the platform does not implement it.
  • Planned when a feature is known to work but not yet implemented or tested.
  • No Means not implemented, sometime implemented but not officially supported.

Basic SQL syntax

INFO

This describes the basic features of the query builder you can reach by chaining its methods.

FeatureMariaDBMySQLPostgreSQLSQLiteSQL ServerNotes
AGGREGATE(...)YesYesYesYesYes-
AGGREGATE() FILTER(...)DowngradeDowngradeYesNoDowngradeFor all other than PostgreSQL, a fallback that uses CASE ... END replaces the FILTER clause.
AGGREGATE() OVER(...)YesYesYesYesYesIn some cases, PARITION BY 1 is automatically added when ORDER BY is present.
DELETE FROM ... [JOIN] ...DialectDialectYesYesYesFirst JOIN is automatically converted to a cross join in FROM for most implementations.
DELETEYesYesYesYesYes-
INSERT IGNOREDowngradeDowngradeDialectPlannedPlannedMariaDB and MySQL can't target a particular constraint violation.
INSERT SELECTYesYesYesYesYes-
INSERT UPDATEDowngradeDowngradeDialectPlannedPlannedMariaDB and MySQL can't target a particular constraint violation.
INSERT VALUESYesYesYesYesYes-
JOINYesYesYesYesYes-
MERGENoNoPlannedNoPlanned-
RETURNING|OUTPUTNoNoDialectNoDialectSQL Server differenciate rows before and after mutation, only rows after mutation are handled.
SELECT DISTINCTYesYesYesYesYes-
SELECT WINDOW AS (...)NoNoYesNoNoOnly PostgreSQL seems to support it, yet we generate it for all.
SELECTYesYesYesYesYes-
UPDATE FROM ... [JOIN] ...DialectDialectYesYesYesFirst JOIN is automatically converted to a cross join in FROM for most implementations.
UPDATEYesYesYesYesYes-
VALUES (...), [...]WarningYesYesYesYesMariaDB doesn't support VALUES aliasing, using it will raise RDMS errors.
WITHYesYesYesYesYesThere is no dialect syntactic differences.
WITH RECURSIVEPlannedPlannedPlannedPlannedPlanned-

Various SQL expressions

Here is an incomplete list of supported arbitrary SQL expressions you can inject anywhere during query building. Most of those are standard or implemented in all supported databases.

INFO

Factory method in the following table refers to methods of the MakinaCorpus\QueryBuilder\ExpressionFactory class.

FeatureMariaDBMySQLPostgreSQLSQLiteSQL ServerFactory methodClassNotes
ARRAY[<expr> [, ...]]YesYesYesYesYesarray()ArrayValue
CASE WHEN <expr> THEN <expr> [...] [ELSE <expr>] ENDYesYesYesYesYescaseWhen()CaseWhen
CAST(<val> AS <type>YesYesYesYesYescast()Cast
CONCAT(<string>, ...)DialectDialectYesYesDialectconcat()ConcatStandard is formatted using the `
IF <expr> THEN <expr> ELSE <expr> ENDYesYesYesYesYesifThen()IfThenIs always converted using a CASE WHEN expression.
VALUES (...) [, ...]WarningYesYesYesYesconstantTable()ConstantTable
ROW (...)YesYesYesYesYesrow()Row
<function>([<expr> [, ...]])YesYesYesYesYesfunctionCall()FunctionCall
NULLYesYesYesYesYesnull()NullValueAlso passing PHP null as a value will format the NULL statement.
HASH(<expr>, <algo>)WarningWarningWarningWarningWarninghash(), md5(), sha1()StringHashOnly MD5() and SHA1() for MariaDB and MySQL, PostgreSQL requires the crypto extension to be enabled for other than MD5().

Various non-standard SQL expressions

Those expressions were added because commonly used in various applications using this query builder.

WARNING

Most are non-standard SQL and sometime requires complex functions or non-efficient generated SQL code in order reach usability.

You can safely use them, but it requires you to understand the generated code if you need to evaluate their performance impact on your choosen RDMS and in your own generated queries.

INFO

Factory method in the following table refers to methods of the MakinaCorpus\QueryBuilder\ExpressionFactory class.

FeatureMariaDBMySQLPostgreSQLSQLiteSQL ServerFactory methodClassNotes
MOD (<val>, <val>)DialectDialectDialectDialectDialectmod()ModuloModulo arithmetic expression.
LPAD(<expr>, <int>, <expr>)DialectDialectDialectDowngradeDowngradelpad()LpadString left pad.
RPAD(<expr>, <int>, <expr>)DialectDialectDialectDowngradeDowngraderpad()RpadString right pad.
RANDOM()DialectDialectDialectWarningDialectrandom()RandomReturns an float number between 0 and 1.
RANDOM_INT()DowngradeDowngradeDowngradeDowngradeDowngraderandomInt()RandomIntReturns a int between given bounds.

Comparison expressions

INFO

Factory method in the following table refers to methods of the MakinaCorpus\QueryBuilder\Where class.

FeatureMariaDBMySQLPostgreSQLSQLiteSQL ServerFactory methodClassNotes
EXSITSYesYesYesYesYesexists()Comparison-
NOT EXISTSYesYesYesYesYesnotExists()Comparison-
=YesYesYesYesYesisEqual()Comparison-
<>YesYesYesYesYesisNotEqual()Comparison-
LIKEYesYesYesYesYesisLike()Like-
NOT LIKEYesYesYesYesYesisNotLike()Like-
ILIKEYesYesYesYesYesisLikeInsensitive()Like-
NOT ILIKEYesYesYesYesYesisNotLikeInsensitive()LikeREGEX itself is subject to dialect peculiarities.
SIMILAR TOYesYesYesYesYesisSimilarTo()SimilarToREGEX itself is subject to dialect peculiarities.
NOT SIMILAR TOYesYesYesYesYesisNotSimilarTo()SimilarTo-
INYesYesYesYesYesisIn()Comparison-
NOT INYesYesYesYesYesisNotIn()Comparison-
>YesYesYesYesYesisGreater()Comparison-
<YesYesYesYesYesisLess()Comparison-
>=YesYesYesYesYesisGreaterOrEqual()Comparison-
<=YesYesYesYesYesisLessOrEqual()Comparison-
BETWEENYesYesYesYesYesisBetween()Between-
NOT BETWEENYesYesYesYesYesisNotBetween()Between-
NULLYesYesYesYesYesisNull()Comparison-
NOT NULLYesYesYesYesYesisNotNull()Comparison-

WARNING

Future work is planned on ARRAY and JSON operators: they were previously implemented in makinacorpus/goat-query package and will be restored in a near future.

Schema alteration (experimental)

FeatureMariaDBMySQLPostgreSQLSQLiteSQL ServerNotes
Add columnYesYesYesYesPlannedCollations might have problems
Drop columnYesYesYesYesPlanned-
Modify columnDowngradeDowngradeYesPlannedPlannedCollations might have problems
Rename columnYesYesYesNoPlanned-
Drop any constraintYesYesYesNoPlanned-
Modify any constraintNoNoNoNoNo-
Rename any constraintNoNoNoNoNo-
Add foreign keyDowngradeDowngradeYesPlannedPlanned-
Modify foreign keyNoNoNoNoNo-
Remove foreign keyYesYesYesPlannedPlanned-
Rename foreign keyNoNoNoNoNo-
Create indexYesYesYesYesPlanned-
Drop indexYesYesYesYesPlanned-
Rename indexYesYesYesYesPlanned-
Add primary keyYesYesYesPlannedPlanned-
Drop primary keyYesYesYesPlannedPlanned-
Create tableYesYesYesYesPlanned-
Drop tableYesYesYesYesPlanned-
Rename tableYesYesYesPlannedPlanned-
Add unique keyYesYesYesYesPlanned-
Drop unique keyYesYesYesYesPlanned-

INFO

MySQL and MariaDB do not support the DEFERRABLE constraints. It will simply be ignored when specified.

INFO

MySQL and MariaDB do not support NULLS [NOT] DISTINCT on keys, attempts in using this feature will raise exceptions.

WARNING

SQLite requires a DROP then CREATE or ADD for most modification or rename operations. This hasn't be implemented yet.

WARNING

SQLite requires a DROP then CREATE or ADD for most modification or rename operations. This hasn't be implemented yet.

WARNING

SQL Server is not implemented yet, but is planned.

WARNING

Collation support is unforgiving, it simply passes the collation names to the SQL server.