Re: number of rows in a cursor - Mailing list pgsql-general

From Bruce Momjian
Subject Re: number of rows in a cursor
Date
Msg-id 200402101237.i1ACbmX27643@candle.pha.pa.us
Whole thread Raw
In response to number of rows in a cursor  (Christoffer Gurell <orbit@0x63.nu>)
Responses Re: number of rows in a cursor
List pgsql-general
Christoffer Gurell wrote:
> After declaring a cursor. Is there any way you can check the number of rows
> that cursor contains ??

    test=> BEGIN;
    BEGIN
    test=> DECLARE xxx CURSOR FOR SELECT * FROM pg_class;
    DECLARE CURSOR
    test=> MOVE ALL IN xxx;
    MOVE 184

Yes, you can MOVE ALL in the cursor and look at the return status, in
this case 184 rows.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: fsync = true beneficial on ext3?
Next
From: Bruno Wolff III
Date:
Subject: Re: Analyze not doing anything?