Databases 9 min read

New and Changed Features in MySQL 9.2.0

MySQL 9.2.0 introduces the CREATE_SPATIAL_REFERENCE_SYSTEM privilege, JavaScript library support, enhanced SQL stored routine APIs, ENUM and SET handling, EXPLAIN FORMAT=JSON version 2, while deprecating several version‑token functions and privileges and removing keyword restrictions, providing a comprehensive overview of additions, deprecations, and removals.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
New and Changed Features in MySQL 9.2.0

1. New or Changed Features

CREATE_SPATIAL_REFERENCE_SYSTEM Privilege

MySQL 9.2.0 introduces the CREATE_SPATIAL_REFERENCE_SYSTEM privilege, which allows users to execute any of the following statements:

CREATE SPATIAL REFERENCE SYSTEM

CREATE OR REPLACE SPATIAL REFERENCE SYSTEM

DROP SPATIAL REFERENCE SYSTEM

If a user lacks this privilege (or the SUPER privilege), executing any of the listed statements raises the following error:

Error number: 6427; Symbol: ER_CMD_NEED_SUPER_OR_CREATE_SPATIAL_REFERENCE_SYSTEM; SQLSTATE: HY000 Message: You need the SUPER or CREATE_SPATIAL_REFERENCE_SYSTEM privilege for command '%s'

JavaScript Library Support

The Multi‑Language Engine (MLE) now supports reusable JavaScript libraries. Functions in a library must be marked with the export keyword to be importable.

Libraries are created and dropped with the CREATE LIBRARY and DROP LIBRARY statements. They can be referenced in CREATE FUNCTION or CREATE PROCEDURE using the USING clause, which accepts one or more library names.

SQL Stored Routine and Session Variable API for JavaScript

MLE now provides schema methods getFunction() and getProcedure() to retrieve stored functions and procedures as JavaScript Function objects.

MySQL user variables are exposed as properties of a global Session object, allowing direct JavaScript access to session variables.

Built‑in Function Access from JavaScript

The following MySQL built‑in functions are directly callable from JavaScript:

rand() (alias of RAND() )

sleep() (alias of SLEEP() )

uuid() (alias of UUID() )

isUUID() (alias of IS_UUID() )

All of these functions can be invoked as methods of the global MySQL object.

JavaScript Transaction API

MLE now offers a JavaScript transaction API that supports most transactional SQL statements, including START TRANSACTION , COMMIT , ROLLBACK , SET AUTOCOMMIT , and Savepoints.

A SqlError object is also provided for error handling.

ENUM and SET Support in JavaScript Stored Routines

Parameters of JavaScript stored routines can now use MySQL ENUM and SET types.

EXPLAIN FORMAT=JSON Version 2

The EXPLAIN FORMAT=JSON output now includes a JSON schema version field. Setting the system variable explain_json_format_version=2 produces output with "json_schema_version": "2.0".

mysql> EXPLAIN FORMAT=JSON SELECT 1\G
*************************** 1. row ***************************
EXPLAIN: {
  "query": "/* select#1 */ select 1 AS `1`",
  "query_plan": {
    "operation": "Rows fetched before execution",
    "access_type": "rows_fetched_before_execution",
    "estimated_rows": 1.0,
    "estimated_total_cost": 0.0,
    "estimated_first_row_cost": 0.0
  },
  "query_type": "select",
  "json_schema_version": "2.0"
}
1 row in set (0.00 sec)

2. Deprecated Features

The following features are deprecated in MySQL 9.2 and may be removed in future releases. Applications should migrate to the suggested alternatives.

Functions (Deprecated)

version_tokens_delete()

version_tokens_edit()

version_tokens_lock_exclusive()

version_tokens_lock_shared()

version_tokens_set()

version_tokens_show()

version_tokens_unlock()

Privilege (Deprecated)

VERSION_TOKEN_ADMIN

System Variables (Deprecated)

version_tokens_session

version_tokens_session_number

3. Removed Features

The following features have been removed in MySQL 9.2.0.

Keyword Restrictions

The BINLOG keyword is now restricted and can no longer be used as a label inside stored routines or functions. Applications should update any affected code before upgrading.

For complete reference, see the official MySQL 9.2 documentation links provided in the source.

javascriptSQLDatabaseMySQLNewFeatures
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login 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.