Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIQxL-000kHu-0e for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Nov 2025 12:25:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIQxJ-000K1k-00 for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Nov 2025 12:25:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIQUB-0000pP-0W for pgsql-bugs@lists.postgresql.org; Mon, 10 Nov 2025 11:55:01 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIQIc-006yND-0u for pgsql-bugs@postgresql.org; Mon, 10 Nov 2025 11:43:08 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4d4npw2ZfTzyRw; Mon, 10 Nov 2025 13:43:04 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1762774984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jD/FRRrwANyYWeO7FoFZJSYpvgwaGJQwFJjYv9Cg5eE=; b=YlMozH8v1YWlXVqUMzPA7+6MMKj5dY4kOKbop2wbTWP5dq+5K4oZCLbkMlAP6VT1+K5DK6 TNlBUY3Ij3WDGIfdH83laF52oJ4vhnF+hoGiRru8Lb+1mMSxZyXP5sJI8gwXbJFFt8Wizg qlrj0ABCczJ0xPWuEW3E39f/SpYgRZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1762774984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jD/FRRrwANyYWeO7FoFZJSYpvgwaGJQwFJjYv9Cg5eE=; b=BkJ08eID9oBCKMDYC8YIWMJi7keC61bHYigZzH1XudFpxACvkNmVe3xUSiArb+7AtiFc5p kyENOSGjDdmQWo3tOwO1nIZWxy53HT5ZQOpT0HMwGCqC1J+K9bx017LUU77NX/rROTRW+C PqI45FYwUKJgJuwsaHQ0lke2Qx0UHy8= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1762774984; a=rsa-sha256; cv=none; b=iuFrUNJJ5Of3s/XNpAP2E0K79PNRtcc9al8IyqwMSROZdR8+k28SNS1zq4+xKbq+SMtGZk HEEZFkenfCfsDZVWKsM6HxrnVafhobbCAvy/yB4a/LKVLbvSb/B2Bd/8wUBv+p6CdaQlaY bgiHoV0rToJb2JZ7uFBomdE6tgmGfmQ= Message-ID: <0e268e59-cc7b-4c0d-aedc-3cfe2db9af45@iki.fi> Date: Mon, 10 Nov 2025 13:43:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: ecpg Fetch issue To: Tzuriel Kahlon , "pgsql-bugs@postgresql.org" References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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