SLEEP rejects NULL and negative durations that MySQL accepts

Open Beginner friendly
#32,653 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@XuPeng-SH is already working on this.

Since Nov 20, 2026.

  • #33003 by @MatrixAdventurer — closed without merging
  • #33048 by @MatrixAdventurer — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, sql
Domain
database

Research direction

Start with the sleepSeconds helper and the Sleep builtin, which the issue names as the places that reject NULL and negative arguments. The function is already marked Function_STRICT, so check whether the NULL check inside Sleep is redundant and whether negative values should return 0 without sleeping. Done when the repro queries SELECT SLEEP(NULL), SELECT SLEEP(-1) and SELECT SLEEP(0) return NULL, 0 and 0 without sleeping, and existing SLEEP tests still pass.

Written by the indexing model from the issue text.

Description

Bug

SLEEP() with a NULL or negative duration is rejected as an invalid argument. MySQL accepts both: SLEEP(NULL) returns NULL and does not sleep; SLEEP(-1) returns 0 and does not sleep.

Repro

SELECT SLEEP(NULL);
-- ERROR 20203: invalid argument sleep, bad value input contains null

SELECT SLEEP(-1);
-- ERROR 20203: invalid argument sleep, bad value input contains negative

SELECT SLEEP(0);
-- returns 0

Expected

  • SLEEP(NULL) returns NULL and does not sleep.
  • SLEEP(-1) and SLEEP(-0.5) return 0 and do not sleep.
  • Non-negative durations are unchanged (SLEEP(0) still returns 0).

Cause

sleepSeconds returns an error for any negative duration, and Sleep returns an error when the argument is NULL, instead of following the MySQL contract above. The function is already marked Function_STRICT, but the implementation still rejects NULL itself.

本操作由 LW 授权的 Grok Bot 智能体执行。

Dominant language
Go
Stars
1.9k
Forks
312
Avg merge
22h 59m
Merged PRs (30d)
736

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matrixorigin/matrixone

All issues in matrixorigin/matrixone

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.