Re: count(*) in binary mode returns 0

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "imagenesis(at)gmail(dot)com" <imagenesis(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: count(*) in binary mode returns 0
Date: 2016-12-05 10:19:31
Message-ID: 70f6e7ed-2e85-4c7d-b2fe-a8ad3285b1d5@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

imagenesis(at)gmail(dot)com wrote:

> nfields: 1
> from_psql 00000000000000000000000000000000 bytes_to_read:4 read:4
> host_order 00000000000000000000000000000000 bytes_to_read:4 read:4
> conv_int ir:0

Note that count(*) produces a bigint (8 bytes), not an int (4 bytes).

=> select pg_typeof(count(1));
pg_typeof
-----------
bigint
(1 row)

Can you check if your code does work when the query is simply
SELECT 1::bigint ?

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Browse pgsql-general by date

  From Date Subject
Next Message basti 2016-12-05 11:40:34 Postgres Traffic accounting
Previous Message Charles Clavadetscher 2016-12-05 09:58:06 Re: Extensions and privileges in public schema