Re: ecpg Fetch issue

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tzuriel Kahlon <tzuriel(dot)kahlon(at)surecomp(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ecpg Fetch issue
Date: 2025-11-10 11:43:03
Message-ID: 0e268e59-cc7b-4c0d-aedc-3cfe2db9af45@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 09/11/2025 15:26, Tzuriel Kahlon wrote:
> Hey ,
> my progra running from Cobol and im using ECPG for that the issue is
> when i use FETCH command the fetch going one by one
> and not take all the rows in batch , there is any solution for that
> regard to change the code itself ?

There's an example in the docs that fetches multiple rows into an array.
See https://www.postgresql.org/docs/18/ecpg-descriptors.html:

> PostgreSQL supports retrieving more that one record in one FETCH statement and storing the data in host variables in this case assumes that the variable is an array. E.g.:
>
> EXEC SQL BEGIN DECLARE SECTION;
> int id[5];
> EXEC SQL END DECLARE SECTION;
>
> EXEC SQL FETCH 5 FROM mycursor INTO SQL DESCRIPTOR mydesc;
>
> EXEC SQL GET DESCRIPTOR mydesc VALUE 1 :id = DATA;

P.S. Please post usage questions like this to pgsql-general in the
future, the pgsql-bugs list is for reporting bugs.

- Heikki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Smolkin Grigory 2025-11-10 12:29:32 clog segment truncation
Previous Message PG Bug reporting form 2025-11-10 11:13:31 BUG #19108: Stack overflow duting query parse