Thread: SELECT COUNT(*)... returns 0 ROWS

SELECT COUNT(*)... returns 0 ROWS

From
"PostgreSQL"
Date:
I have instaled Postgres 7.3.4 on RH 9,
if I excecute:

select count(*) from cj_tranh;
 count
-------
     0
(1 row)

Why the result us CERO? the table have 1.400.000 rows!
What is wrong? Anybody help please.


Re: SELECT COUNT(*)... returns 0 ROWS

From
Jeff
Date:
On Fri, 31 Oct 2003 13:33:09 -0600
"PostgreSQL" <postgres@coopelesca.co.cr> wrote:

> I have instaled Postgres 7.3.4 on RH 9,
> if I excecute:
>
> select count(*) from cj_tranh;
>  count
> -------
>      0
> (1 row)
>
> Why the result us CERO? the table have 1.400.000 rows!
> What is wrong? Anybody help please.
>

1. did you remember to load data?
2. did someone accidentally delete the data?
3. are you connected to the correct db (I've panic'd before but realized
I was on dev, not production!)?
4. sure that is the right table?

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/

Re: SELECT COUNT(*)... returns 0 ROWS

From
Tom Lane
Date:
Jeff <threshar@torgo.978.org> writes:
> "PostgreSQL" <postgres@coopelesca.co.cr> wrote:
>> Why the result us CERO? the table have 1.400.000 rows!

> 1. did you remember to load data?
> 2. did someone accidentally delete the data?
> 3. are you connected to the correct db (I've panic'd before but realized
> I was on dev, not production!)?
> 4. sure that is the right table?

I'm wondering about MVCC-related conditions, which adds a couple
more questions:

5. Did you actually commit the transaction that loaded the rows?
6. Are you doing the SELECT COUNT(*) in a transaction that started
   before the data-loading transaction committed?

            regards, tom lane

Re: SELECT COUNT(*)... returns 0 ROWS

From
"PostgreSQL"
Date:
Thank to all

I was in the WRONG database. Sorry, and thanks!


-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff <threshar@torgo.978.org>
Cc: "PostgreSQL" <postgres@coopelesca.co.cr>, pgsql-admin@postgresql.org
Date: Fri, 31 Oct 2003 16:27:31 -0500
Subject: Re: [ADMIN] SELECT COUNT(*)... returns 0 ROWS

> Jeff <threshar@torgo.978.org> writes:
> > "PostgreSQL" <postgres@coopelesca.co.cr> wrote:
> >> Why the result us CERO? the table have 1.400.000 rows!
>
> > 1. did you remember to load data?
> > 2. did someone accidentally delete the data?
> > 3. are you connected to the correct db (I've panic'd before but
> realized
> > I was on dev, not production!)?
> > 4. sure that is the right table?
>
> I'm wondering about MVCC-related conditions, which adds a couple
> more questions:
>
> 5. Did you actually commit the transaction that loaded the rows?
> 6. Are you doing the SELECT COUNT(*) in a transaction that started
>    before the data-loading transaction committed?
>
>             regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org