Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwPMT-00026H-Sw for pgsql-general@arkaria.postgresql.org; Thu, 24 Jun 2021 13:25:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwPLw-0006ZD-I9 for pgsql-general@arkaria.postgresql.org; Thu, 24 Jun 2021 13:25:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwPLw-0006WJ-8K for pgsql-general@lists.postgresql.org; Thu, 24 Jun 2021 13:25:08 +0000 Received: from mail.am-soft.de ([83.218.36.120]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwPLt-0001Nq-1p for pgsql-general@lists.postgresql.org; Thu, 24 Jun 2021 13:25:07 +0000 Received: from mail.am-soft.de (localhost [127.0.0.1]) by mail.am-soft.de (Postfix) with ESMTP id E2D623CB6C28; Thu, 24 Jun 2021 15:25:02 +0200 (CEST) Received: from Bit02EX.bitstoregruppe.local (exchange01.bitstore.group [116.202.141.225]) by mail.am-soft.de (Postfix) with ESMTPA id D5E173CB6C26 for ; Thu, 24 Jun 2021 15:25:02 +0200 (CEST) Received: from tschoening-nb.fritz.box (77.78.163.99) by Bit02EX.bitstoregruppe.local (192.168.254.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 24 Jun 2021 15:24:52 +0200 Date: Thu, 24 Jun 2021 15:24:52 +0200 From: =?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?= Organization: AM-SoFT IT-Service - Bitstore Hameln GmbH Message-ID: <841401823.20210624152452@am-soft.de> To: Subject: How much data does server side "loread" return? MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [77.78.163.99] X-ClientProxiedBy: Bit02EX.bitstoregruppe.local (192.168.254.21) To Bit02EX.bitstoregruppe.local (192.168.254.21) X-C2ProcessedOrg: e1a4acb5-ea26-4a8f-9559-e23e579650e8 X-AV-Checked: ClamAV using ClamSMTP List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all, I need to read some large object and am wondering how much data "loread" returns in case it successfully reads at all AND the object contains at least as much data as requested. In that case, does "loread" always return the requested amount of data or does one need to always loop when calling that function? I didn't find any explicit docs regarding that point and almost all examples I saw where issuing one call with large amounts of requested data, regardless of the size of the large object. The latter most likely means that if available, all requested data is always returned. Besides that, if "loread" is used in a loop for various reasons already, one would need to count the overall number of bytes read to know when the last chunk was read. Instead, it would be enough to check for if the last returned chunk is less than requested. > LOOP > chunk :=3D loread(fd, CHUNK_SIZE); > chunkSize :=3D length(chunk); > fdRead :=3D fdRead + chunkSize; > [...] > --EXIT WHEN (chunkSize < CHUNK_SIZE); > EXIT WHEN (fdRead =3D fdSize); > END LOOP; Is the first EXIT sufficient already and "fdRead" unnecessary? Thanks! Mit freundlichen Gr=C3=BC=C3=9Fen Thorsten Sch=C3=B6ning --=20 AM-SoFT IT-Service - Bitstore Hameln GmbH Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister f=C3=BCr IT u= nd TK E-Mail: Thorsten.Schoening@AM-SoFT.de Web: http://www.AM-SoFT.de/ Tel: 05151- 9468- 0 Tel: 05151- 9468-55 Fax: 05151- 9468-88 Mobil: 0178-8 9468-04 AM-SoFT IT-Service - Bitstore Hameln GmbH, Brandenburger Str. 7c, 31789 Ham= eln AG Hannover HRB 221853 - Gesch=C3=A4ftsf=C3=BChrer: Janine Galonska F=C3=BCr R=C3=BCckfragen stehe ich Ihnen sehr gerne zur Verf=C3=BCgung. Mit freundlichen Gr=C3=BC=C3=9Fen Thorsten Sch=C3=B6ning Tel: 05151 9468 0 Fax: 05151 9468 88 Mobil:=20 Webseite: https://www.am-soft.de=20 AM-Soft IT-Service - Bitstore Hameln GmbH i.G.=C2=A0ist ein Mitglied der Bi= tstore Gruppe - Ihr Full-Service-Dienstleister f=C3=BCr IT und TK AM-Soft IT-Service - Bitstore Hameln GmbH i.G. Brandenburger Str. 7c 31789 Hameln Tel: 05151 9468 0 Bitstore IT-Consulting GmbH Zentrale - Berlin Lichtenberg Frankfurter Allee 285 10317 Berlin Tel: 030 453 087 80 CBS IT-Service - Bitstore Kaulsdorf UG Tel: 030 453 087 880 1 B=C3=BCro Dallgow-D=C3=B6beritz Tel: 03322 507 020 B=C3=BCro Kloster Lehnin Tel: 033207 566 530 PCE IT-Service=C2=A0- Bitstore Darmstadt UG Darmstadt Tel: 06151 392 973 0 B=C3=BCro Neuruppin Tel: 033932 606 090 ACI EDV Systemhaus - Bitstore Dresden GmbH Dresden Tel: 0351 254 410 Das Systemhaus - Bitstore Magdeburg GmbH Magdeburg Tel: 0391 636 651 0 Allerdata.IT - Bitstore Wittenberg GmbH Wittenberg Tel: 03491=C2=A0876 735 7 B=C3=BCro Liebenwalde Tel: 033054 810 00 HSA - das B=C3=BCro - Bitstore Altenburg UG Altenburg Tel: 0344 784 390 97 Bitstore IT =E2=80=93 Consulting GmbH NL Piesteritz=20 Piesteritz Tel: 03491 644 868 6 Solltec IT-Services - Bitstore Braunschweig UG Braunschweig Tel: 0531 206 068 0 MF Computer Service - Bitstore G=C3=BCtersloh GmbH G=C3=BCtersloh Tel: 05245=C2=A0920 809 3 Firmensitz: AM-Soft IT-Service - Bitstore Hameln GmbH i.G. , Brandenburger = Str. 7c , 31789 Hameln Gesch=C3=A4ftsf=C3=BChrer Janine Galonska