Bug #37305 select count(*); returns value
| Submitted: | 10 Jun 2008 9:53 | Modified: | 14 Aug 2008 16:40 |
|---|---|---|---|
| Reporter: | Philip Stoev | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 5.0/5.1/6.0, 5.7.18 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[10 Jun 2008 9:53]
Philip Stoev
[10 Jun 2008 10:38]
MySQL Verification Team
Thank you for the bug report.
[10 Jun 2008 12:07]
Paul DuBois
re: " mysql> select count(*) fromQ; +-------+ | fromQ | +-------+ | 1 | +-------+ 1 row in set (0.00 sec) A single missing space would cause a bad query to actually work and return a bogus answer. " The "bad query " is not necessarily a bad query. It's a query of the form "SELECT value alias_name", equivalent to "SELECT value AS alias_name".
[10 Jun 2008 12:20]
Philip Stoev
Yes I understand the parsing problem with the AS being optional. I just wanted to point out that there are cases where allowing a standalone count(*) to return 1 can really bite the user.
[14 Aug 2008 16:40]
Philip Stoev
This bug is verified, it was mistakenly left in "Analysing".
[10 Jun 2014 10:58]
Hartmut Holzgraefe
It might be debatable whether COUNT(*) without a table should return 0 or 1, but as PostgreSQL and SQLite behave the same way I'd say: not a bug
[13 Jul 2017 8:01]
MySQL Verification Team
Bug #87051 marked as duplicate of this one
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.