Repository navigation
Description
Description
Two documented MySQL metadata-expression functions remain unusable, breaking tools that rely on them:
-
DEFAULT(colname)— the column-default function (https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_default) — is a parser error everywhere: as a SELECT expression, in INSERT value lists, and in UPDATE assignments. MySQL returns the column's declared default (or NULL when none), andINSERT ... VALUES (DEFAULT(col))writes the default explicitly. -
LAST_INSERT_ID(expr)— the documented "set-and-return" form (https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_last-insert-id) — still fails withERROR 20203 (HY000): invalid argument function last_insert_id, bad value [BIGINT]in plain SELECT contexts on current main. [Compatibility]: LAST_INSERT_ID(expr) is rejected in ODKU assignments #28163 (closed) covered only the ODKU-assignment form; the everydaySELECT LAST_INSERT_ID(500)idiom used by app code to chain generated keys stays rejected. MySQL sets the session value to 500 and returns 500; the next argument-freeLAST_INSERT_ID()then returns 500.
Both are hard rejections of SQL that MySQL 8 accepts, so any query template/ORM macro embedding them fails wholesale.
Environment
- MatrixOne dev build
3a1e42b430, server reports8.0.30-MatrixOne-v1.3.0 - MySQL comparison: 8.0.45 (localhost)
Reproduction
CREATE TABLE rf (id INT PRIMARY KEY, a INT, b VARCHAR(10));
INSERT INTO rf VALUES (1, 10, 'x');
-- 1. DEFAULT(colname)
SELECT DEFAULT(b) FROM rf LIMIT 1;
-- MatrixOne: ERROR 1064 parser error near " default(b) from rf limit 1"
-- MySQL 8.0.45: NULL (b has no default; with a default it returns that value)
INSERT INTO rf VALUES (2, DEFAULT, DEFAULT(b));
-- MatrixOne: ERROR 1064 near "(b))"
-- MySQL: row inserted with defaults
-- 2. LAST_INSERT_ID(expr)
SELECT LAST_INSERT_ID(500);
-- MatrixOne: ERROR 20203: invalid argument function last_insert_id, bad value [BIGINT]
-- MySQL: 500, and a following SELECT LAST_INSERT_ID() returns 500
SELECT a, LAST_INSERT_ID(500) AS set500 FROM rf LIMIT 1;
-- MatrixOne: same 20203 rejection even inside a select list over a tableImpact examples: MySQL-workbench-generated "insert row with all defaults" snippets embed DEFAULT(col); PHP/legacy Java code uses LAST_INSERT_ID(n) to persist a chosen key for later retrieval — both die with parse/runtime errors instead of returning values.
Related
- [Compatibility]: LAST_INSERT_ID(expr) is rejected in ODKU assignments #28163 (CLOSED) fixed the ODKU-assignment form of LAST_INSERT_ID(expr); the naked-SELECT and select-list forms remain broken on
3a1e42b430, so this is either a scope gap or a regression of that fix outside ODKU. BENCHMARK(10, 1+1)is also rejected (20105 not supported) while MySQL 8 still returns 0 — low priority (deprecated), listed only for the compatibility ledger.
Activity