public inbox for [email protected]  
help / color / mirror / Atom feed
From: Célestin Matte <[email protected]>
To: PostgreSQL WWW <[email protected]>
Subject: [PATCH] pgarchives: Bugfix: allow message's parentid to be null
Date: Mon, 25 Oct 2021 16:52:55 +0200
Message-ID: <[email protected]> (raw)

Hello,

Upon execution of load_messages.py, when creating a new thread, I get a crash:
(Sorry about the format, I get this out of strace)

Traceback (most recent call last):\n  File \"/srv/pgarchives/local/loader/load_message.py\", lin\
e 174, in <module>\n    ap.store(conn, listid, opt.overwrite, opt.overwrite)\n  File \"/srv/pgarchives/local/loader/li\
b/storage.py\", line 232, in store\n    'rawtxt': bytearray(self.rawtxt),\npsycopg2.errors.NotNullViolation: null valu\
e in column \"parentid\" violates not-null constraint\nDETAIL:  Failing row contains (2, 2, cmatte <cmatte@[my_domain]\
.tld>, helloworld@[my_pglister_domain], , Test archive after redeployment 2, 2021-10-25 14:13:32+00, 1635171212.3\
49997.1068459.nullmailer@[my_domain], hello world\n\n\n\n, null, f, null, \\x46726f6d2068656c6c6f776f726c642d6f776\
e65722b617263686976654062..., '2':5A 'after':3A 'archive':2A 'hello':6 'redeployment':4A 'test...).\n\n

I think the way to fix this is simply to allow message.parentid to be null.

Cheers,
-- 
Célestin Matte

Attachments:

  [text/x-patch] 0001-Bugfix-allow-message-s-parentid-to-be-null.patch (1.1K, 2-0001-Bugfix-allow-message-s-parentid-to-be-null.patch)
  download | inline diff:
From ba3852df7a69a1a25dd366fd3657fce3740cf23f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Mon, 25 Oct 2021 16:42:49 +0200
Subject: [PATCH] Bugfix: allow message's parentid to be null

Otherwise, load_message.py will crash upon creation of a new thread
---
 django/archives/mailarchives/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/django/archives/mailarchives/models.py b/django/archives/mailarchives/models.py
index 44c4469..879d280 100644
--- a/django/archives/mailarchives/models.py
+++ b/django/archives/mailarchives/models.py
@@ -25,7 +25,7 @@ class Message(models.Model):
     messageid = models.TextField(null=False)
     bodytxt = models.TextField(null=False)
     # rawtxt is a bytea field, which django doesn't support (easily)
-    parentid = models.IntegerField(null=False, blank=False)
+    parentid = models.IntegerField(null=True, blank=False)
     has_attachment = models.BooleanField(null=False, default=False)
     hiddenstatus = models.IntegerField(null=True)
     # fti is a tsvector field, which django doesn't support (easily)
-- 
2.33.1



view thread (5+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [PATCH] pgarchives: Bugfix: allow message's parentid to be null
  In-Reply-To: <[email protected]>

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

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