cockroachdb / cockroachdb/cockroach

sql: `pg_sleep` should return null rather than bool when finished

Open
#98,913 2 comments 0 reactions 0 assignees View on GitHub
A-sql-pgcompat branch-master branch-release-23.2 branch-release-24.1 branch-release-24.2 branch-release-24.3 C-bug T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

In [Postgres's code](https://github.com/postgres/postgres/blob/3e59e5048d0f20debe4ad79b2e02ca2a76c5daed/src/backend/utils/adt/misc.c#L413), the `pg_sleep` builtin always return null when finished, while cockroach always return true.

CRDB:
```
root@localhost:26257/defaultdb> SELECT i, pg_sleep(0.5) FROM generate_series(1, 6) AS g(i);
i | pg_sleep
----+-----------
1 | t
2 | t
3 | t
4 | t
5 | t
6 | t
(6 rows)
```

Postgres 13.3:
```
postgres=# SELECT i, pg_sleep(0.5) FROM generate_series(1, 6) AS g(i)
postgres-# ;
i | pg_sleep
---+----------
1 |
2 |
3 |
4 |
5 |
6 |
(6 rows)
```

Jira issue: CRDB-45332

Epic CRDB-60810

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.