Get count of records from SELECT - Mailing list pgsql-general

From Zet
Subject Get count of records from SELECT
Date
Msg-id 5421621000.20051115175627@on.kg
Whole thread Raw
In response to Performance of a view  (John McCawley <nospam@hardgeus.com>)
Responses Re: Get count of records from SELECT  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Hi

I have example:

rnum := 0;
FOR r IN EXECUTE ''SELECT *
    FROM ''||table_name||''
    WHERE var = ''||var
LOOP
    IF rnum = 0 THEN
        -- how could I get the count of records here ???
        -- I tried GET DIAGNOSTICS rcount = ROW_COUNT;
        -- BUT it returns ZERO = 0 :(
    END IF;
    rnum := rnum + 1;
END LOOP;

-- here I will get count of records in "rnum", but I need in LOOP's
-- first step

Many thanx from Zet


pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: 3 x PostgreSQL in cluster/redunant
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Get count of records from SELECT