Authorizing select count()
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46013psql -h localhost -U postgresBuilt from patchset v1 (message #1), August 10, 2026 at 10:34 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t46013_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t46013_1 && git checkout t46013_1Patchset v1 (message #1) is on t46013_1
Hello,
Vik Fearing pointed out the inconsistency in the SQL Standard that imposes
using count(*) (with a star) but row)number() without it.
Vik's point of view is that we should be able to use row_number with a
star, which is already implemented in Postgres.
My point of view is we could add support for count(). It does not remove
the compliance with the SQL Standard, it just adds an extra feature.
You will find enclosed a patch proposal to allow count to be used without a
star. I, on purpose, decided not to document this behavior, maybe that's
wrong.
Have a great day,
Lætitia
On Wed, May 25, 2022 at 12:26:47PM +0200, Laetitia Avrot wrote:
You will find enclosed a patch proposal to allow count to be used without a
star. I, on purpose, decided not to document this behavior, maybe that's
wrong.
This originates from 108fe47, most likely as part of this thread. The
patch proposed by Sergey did not include this restriction, though:
/messages/by-id/Pine.LNX.4.64.0607241340090.19158@lnfm1.sai.msu.ru
Tom?
--
Michael
Michael Paquier <michael@paquier.xyz> writes:
On Wed, May 25, 2022 at 12:26:47PM +0200, Laetitia Avrot wrote:
You will find enclosed a patch proposal to allow count to be used without a
star. I, on purpose, decided not to document this behavior, maybe that's
wrong.
This originates from 108fe47, most likely as part of this thread.
I'm fairly sure that in the past we've considered this idea and rejected
it, mainly on the grounds that it's a completely gratuitous departure
from SQL standard. I quite agree that the syntax without star would be
saner, but once we get into inventing "saner" variants of SQL syntax,
where do we stop? And how much are we buying really?
I definitely don't agree with doing it but not documenting it; that
will just result in endless confusion.
regards, tom lane
I wrote:
I'm fairly sure that in the past we've considered this idea and rejected
it, mainly on the grounds that it's a completely gratuitous departure
from SQL standard.
After some more digging I found the thread that (I think) the "mere
pedantry" comment was referring to:
/messages/by-id/Pine.LNX.4.44.0604131644260.20730-100000@lnfm1.sai.msu.ru
There's other nearby discussion at
/messages/by-id/4476BABD.4080100@zigo.dhs.org
(note that that's referring to the klugy state of affairs before 108fe4730)
Of course, that's just a couple of offhand email threads, which should
not be mistaken for graven stone tablets. But I still don't see much
advantage in deviating from the SQL-standard syntax for COUNT(*).
regards, tom lane