pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18070: Assertion failed when processing error from plpy's iterator
Date: Sun, 17 Sep 2023 08:50:13 +0900
Message-ID: <ZQY/Nfv20tt4PBzA@paquier.xyz> (raw)
In-Reply-To: <5eba3ea5-ae13-aab2-35d6-cd3e58dab08b@gmail.com>
References: <18070-ab9c171cbf4ebb0f@postgresql.org>
	<9fa9c154-d084-07de-8224-aab7fc8a119e@gmail.com>
	<ZQVm8KponTxqj8G3@paquier.xyz>
	<3920993.1694874885@sss.pgh.pa.us>
	<5eba3ea5-ae13-aab2-35d6-cd3e58dab08b@gmail.com>

On Sat, Sep 16, 2023 at 08:00:00PM +0300, Alexander Lakhin wrote:
> This lengthy output is similar to what we get with a recursion in plperl,
> so I don't consider this as an issue, but may be we could just check
> the length of an error message before concatenation...
> 
> Please look at the v2 patch, which contains an addition to regression tests for the master.
> If you agree with this approach, I'll make patches for back branches as well...

+DETAIL:  spiexceptions.InvalidDatetimeFormat: invalid value "DD" for "DD"
+Value must be an integer.

That's the kind of things we've been doing for years in libpq.  So
even if there are no proper sentence terminations, that may be enough
for the user.

+		if (detail == NULL)
 			detail = xmsg;
+		else if (xmsg != NULL) {
+			initStringInfo(&detailstr);
+			appendStringInfoString(&detailstr, xmsg);
+			appendStringInfoChar(&detailstr, '\n');
+			appendStringInfoString(&detailstr, detail);
+			detail = detailstr.data;
+		}

Perhaps it would be slightly cleaner to use a StringInfoData all the
time and rely on the presence of fmt to free the detail string?

Btw, backpatching a change in the error infrastructure does not seem a
good idea to me, as there could be applications that depend on the
existing behaviors?  It looks like we'd better just remove the
assertion in back-branches.
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../ZQY%2FNfv20tt4PBzA@paquier.xyz/2-signature.asc)
  download

view thread (15+ messages)  latest in thread

Message-ID: <ZQY/Nfv20tt4PBzA@paquier.xyz>
Permalink:  ../ZQY%2FNfv20tt4PBzA@paquier.xyz/
Also on:    postgresql.org/message-id/ZQY/Nfv20tt4PBzA@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, exclusion@gmail.com, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18070: Assertion failed when processing error from plpy's iterator
  In-Reply-To: <ZQY/Nfv20tt4PBzA@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox