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 1vVk40-006xkF-0c for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 05:27:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVk3y-00AE4X-2v for pgsql-general@arkaria.postgresql.org; Wed, 17 Dec 2025 05:27:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVk3y-00AE4O-1n for pgsql-general@lists.postgresql.org; Wed, 17 Dec 2025 05:27:03 +0000 Received: from mail-yx1-xb12e.google.com ([2607:f8b0:4864:20::b12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVk3x-0015mz-2u for pgsql-general@postgresql.org; Wed, 17 Dec 2025 05:27:02 +0000 Received: by mail-yx1-xb12e.google.com with SMTP id 956f58d0204a3-6432842cafdso4952420d50.2 for ; Tue, 16 Dec 2025 21:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765949221; x=1766554021; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uWP4nBBCVh+CJiZ2bGLQVOvjRcif3xbJsyLkUX0/ZSg=; b=bygVUumZH9wJclT6cMQFBQ98phyFxDDtClTlanh4NPDSDKMaWPqkLtA6jWBxeooiLm CycsOeua2hoapyWS4wrUEuBrwwupYGmn6IGNJ6xHAx767bkqBWEcC5o9h8MlN6t5mtXj g1wswuAV9OcOnV0eJNCqA4oPhbpAzp8+L7mWwj3rhHN+lY6hL9ngIEXzbCHC9H70q898 xu1K/TGoBi8OzyGFz8/9M5eX8Yg6JyftbH6HXuTlaHSFWkYbyAulhhmk57+HR9nPs+r1 o09mLVP889U6yKZmUfeM3dw+3CTar1XKdirzw7yzOQnV47ZcJNb7aC5dCP0OBxkC5liv imSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765949221; x=1766554021; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uWP4nBBCVh+CJiZ2bGLQVOvjRcif3xbJsyLkUX0/ZSg=; b=CTWPdJW1tENUCUj9EuszMRJdVhFNBQiSbNgiJ4xozG03FqVknRiPbdEzZhgnN35Hr8 27Cvc+2Z+/kgCFPSPH7A+wTVJ07CP6tYBv8ubAgRdlrtgADnZypqVhCKGwVmdCOryquk TVpMrl+isxsxgNxgIPDpR3/6CgH1EILRNWWXNINwtdOUbq9f521npEEisgF+FaHp4Ncm 2WLDrQaUptDDVXpNvkdotz9zrqIGZS5d7UKwc2U7Dx7Ubi/bJz+405s37JT1w2EAc0Uf M/hD+JcIqXjZNraamNGQEy06sGUuZ4PDHJsGWedS36LRkCE0Z6YEloe5AcMwcD8Wxq6G Kbyw== X-Forwarded-Encrypted: i=1; AJvYcCWednd09FhUMZeGqRJJADubBLUBWEhDDC3x0EgOq5KGDl1qPLqATdjcUrn3rmeqO/D33rEOke7ju/0DbyA4@postgresql.org X-Gm-Message-State: AOJu0Yww7yJrNMQNJz5eI30INJZqGhH4ANpqsCiWJxE19vuXIJ7m5eFw P0/gRuZQvROj+3+PCNEshT1H9W+/ktEGq3MviZA2+XX9s3+E3g+5xHaOMZKNMweQ3jO+5GMbwGd fxvCMcNiuJHfoCxE5wFgpEczRx056UjQ= X-Gm-Gg: AY/fxX5lGQOQ+hMOsab1B1zCY+ge0x38URlovCLuIy2DnLWV6aqyI/xCPuLCDdA9w1b W19duK2WEO47nBN/uasEHZaAYLIycDNI1tf7BLaFmPIWE0tGEfUX38ECV2hiMM6lBxwdDGiAQJC TX6GFgwmezvxTV+D4y2CnOTrXpN9CmPLtk+tyFiPzStyvTr3RPeSuow6WwXQmwpQaSUzXuaXEj8 TBDMBTrmhY5xQ+tOizL5tkkKcISbWI/Wk5E+0kw9dsf4xlMf0o5A5TOP6sFePI1gstduLhDzadh QUZOhSId0g/VSORyjhzeW1Ocb3o= X-Google-Smtp-Source: AGHT+IHqcARnAzHzzPrnrXuyXNuOVKne+8gZZAGyOO7eW8qJcxyWz+trvZ8OTQuTEpU+FUKOOdZpOPLs/7irYNl19YY= X-Received: by 2002:a05:690e:4005:b0:645:61fc:43c2 with SMTP id 956f58d0204a3-64561fc463fmr8187805d50.8.1765949220618; Tue, 16 Dec 2025 21:27:00 -0800 (PST) MIME-Version: 1.0 References: <32584.1503579096@sss.pgh.pa.us> <14978.1503586593@sss.pgh.pa.us> <17247.1503616204@sss.pgh.pa.us> <20937.1503760366@sss.pgh.pa.us> In-Reply-To: From: Igor Korot Date: Tue, 16 Dec 2025 21:26:56 -0800 X-Gm-Features: AQt7F2qmYg32zQXdG1mFcRkZBx26LNc9FpBNEwIzi8f4MNVRahRMa_PMwF4GcJE Message-ID: Subject: Re: [GENERAL] Retrieving query results To: Michael Paquier Cc: Tom Lane , pgsql-general Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, ALL, On Sun, Aug 27, 2017 at 11:05=E2=80=AFPM Michael Paquier wrote: > > On Sun, Aug 27, 2017 at 12:12 AM, Tom Lane wrote: > > Michael Paquier writes: > >> On Fri, Aug 25, 2017 at 8:10 AM, Tom Lane wrote: > >>> I think the real problem occurs where we realloc the array bigger. > > > >> Looking at the surroundings, I think that it would be nice to have > >> pqAddTuple and PQsetvalue set an error message with this patch. > > > > Yeah, I was thinking about that myself - the existing design presumes > > that the only possible reason for failure of pqAddTuple is OOM, but > > it'd be better to distinguish "too many tuples" from true OOM. So > > we should also refactor to make pqAddTuple responsible for setting > > the error message. Might be best to do the refactoring first. > > Attached are two patches: > 1) 0001 refactors the code around pqAddTuple to be able to handle > error messages and assign them in PQsetvalue particularly. > 2) 0002 adds sanity checks in pqAddTuple for overflows, maximizing the > size of what is allocated to INT_MAX but now more. > > pqRowProcessor() still has errmsgp, but it is never used on HEAD. At > least with this set of patches it comes to be useful. We could rework > check_field_number() to use as well an error message string, but I > have left that out to keep things simple. Not sure if any complication > is worth compared to just copying the error message in case of an > unmatching column number. > > Attached is as well a small program I have used to test PQsetvalue > through PQcopyResult to see if results get correctly allocated at each > call, looking at the error message stacks on the way. Is this now part of the main libpq codebase? Thank you. > -- > Michael