pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Cc: Torstein Tauno Svendsen <torstei@visena.com>
Subject: Re: Segmentation fault with PG-12
Date: Thu, 10 Oct 2019 09:05:06 +0200 (CEST)
Message-ID: <VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena> (raw)
In-Reply-To: <877e5duq7t.fsf@alap4.lan>

På torsdag 10. oktober 2019 kl. 07:25:26, skrev Andres Freund <
andres@anarazel.de <mailto:andres@anarazel.de>>: On 2019-10-09 10:16:37 -0400, 
Tom Lane wrote:
 > Andreas Joseph Krogh <andreas@visena.com> writes:
 > > Attached is output from "bt full". Is this helpful?
 >
 > Well, it shows that the failure is occurring while trying to evaluate
 > a variable in a trigger's WHEN clause during
 > "UPDATE origo_email_delivery SET folder_id=$1, created=$2\nWHERE entity_id 
IN ($3)\nRETURNING entity_id"
 > And I'd bet that the root cause is something to do with Andres' tuple slot
 > work. But (at least to my eye) it's not apparent exactly what's wrong.

 It looks like this could "just" be another report of #16036, which was
 already fixed in:

 commit d986d4e87f61c68f52c68ebc274960dc664b7b4e
 Author: Andres Freund <andres@anarazel.de>
 Date: 2019-10-04 11:59:34 -0700

 Fix crash caused by EPQ happening with a before update trigger present.

(Tom: This mail is only viewable as text/html, to if you're reading the 
text/plain version it will seem "hashed") Aha, that whould be 
60e97d63e5d19098e11fa32431a20eea820e2ae9 in REL_12_STABLE We'll build and run 
HEAD of REL_12_STABLE, and report back. > This doesn't seem to correlate with 
your original report, btw,
 > as that claimed the crash was during COMMIT.

 That however, would be confusing, unless there's some deferred trigger
 that causes another update, which then fires a before update trigger
 causing the problem.

 Greetings,

 Andres Freund We have a deferred trigger which updates origo_email_delivery: 
CREATE OR REPLACE FUNCTIONorigo_index_email_props_tf() RETURNS TRIGGER AS $$ 
declare v_prop origo_email_message_property; BEGIN v_prop := NEW; UPDATE 
origo_email_delivery SET is_seen = v_prop.is_seen, followup_id = 
v_prop.followup_id, is_replied = v_prop.is_replied, is_forwarded = 
v_prop.is_forwarded, is_draft = v_prop.is_draft, is_done = v_prop.is_done, 
is_flagged = v_prop.is_flagged, modseq =greatest(modseq, v_prop.modseq) WHERE 
message_id = v_prop.message_idAND owner_id = v_prop.owner_id; RETURN NEW; END; 
$$LANGUAGE plpgsql; CREATE CONSTRAINT TRIGGER origo_index_email_props_t AFTER 
INSERT OR UPDATE ON origo_email_message_property DEFERRABLE INITIALLY DEFERRED  
FOR EACH ROWEXECUTE PROCEDURE origo_index_email_props_tf(); .. and then trigger 
the following UPDATE-trigger: CREATE TRIGGER origo_email_delivery_update_t 
BEFORE UPDATE ON origo_email_delivery FOR EACH ROW  WHEN (OLD.folder_id <> NEW
.folder_idOR NEW.is_deleted <> OLD.is_deleted) EXECUTE PROCEDURE 
origo_email_delivery_update_tf(); Maybe that will trigger the bug. Thanks. -- 
Andreas Joseph Krogh CTO / Partner - Visena AS Mobile: +47 909 56 963 
andreas@visena.com <mailto:andreas@visena.com> www.visena.com 
<https://www.visena.com;  <https://www.visena.com;

view thread (15+ messages)  latest in thread

Message-ID: <VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena>
Permalink:  ../VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andreas@visena.com, andres@anarazel.de, tgl@sss.pgh.pa.us, torstei@visena.com
  Subject: Re: Segmentation fault with PG-12
  In-Reply-To: <VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena>
  References: <877e5duq7t.fsf@alap4.lan> <VisenaEmail.15.db251c0f6645bb8a.16db46dfe94@tc7-visena>

* 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