Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKnv9-0002PH-Mi for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Nov 2018 17:16:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gKnv5-0000WP-J3 for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Nov 2018 17:16:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKnBf-00031N-Cg for pgsql-bugs@lists.postgresql.org; Thu, 08 Nov 2018 16:29:43 +0000 Received: from mail-yw1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gKnBb-0002Zo-4h for pgsql-bugs@lists.postgresql.org; Thu, 08 Nov 2018 16:29:43 +0000 Received: by mail-yw1-xc2e.google.com with SMTP id l2-v6so8224693ywb.9 for ; Thu, 08 Nov 2018 08:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=b1MhnoEjEOd4xZPgvGn+XbRPzNrunAnZyEHXKKLYwhE=; b=gBVUFwCcMW9xW5zqmWa3XCJWo0rwn3/u3WLjQ9DQLk2fQ0jgVpyHnUKBuAebEQw1zJ XgTfPkGvx+FHVY8QpX1uHhYuS0nazOp2ZcBHtV6cyT8k+UZa+wlRonGN4ZzFfzm0pbHc cOXtpNV/LOSkEbZhpo/ESH5PcNWr81/RKXy91Y/9jc6yJyDUXGde6LFRf+t4ENwQXyfi Jrf2BalgnsllHuJOVhuci2YBQgkLgEsd2O7FBddmXhdQxJ5UUscYWUqRtvU5TOoOcQd+ 83JMW/Xub3jqGQ99DKUmoGynY2wy7yH+gMEGbrm+F+09hBeTiCGo6/DCgPrfLcDftDqS kvXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=b1MhnoEjEOd4xZPgvGn+XbRPzNrunAnZyEHXKKLYwhE=; b=Ez+Za+0Jf4xFPCGZfayOPf31S5lNbuIz0NOWThrQbyV96Il+Pt7aFINrgNWoN9zDpw SEx0GNIUl4c1UyuRMlbBtcb9Q97NXPtAtS+Fp6vsa/31BlGx4OKNe7NUsFtf4EfFYsF4 SKMF4PoV33uNu1x5mZuOOUv/RYWkJWgIBWGKX1eW8voUV4+vWNX0APg3VXD1mwVSf1Pd cNTlY6ZtoGFyqkemF8k6SwA/e7S8p7M9L+OH/mC0Hx1q6NKq8PfQ05/KpHtueozyW5Dh XgJ6Gb0wtqCZyIYfAOWWYTYpi57XL7iMeUS/picG0ZflHO9oFYZSZCnFAvMQPwdZiwOR TusA== X-Gm-Message-State: AGRZ1gI6xz367uinaBpYl7eEPCmZKu9cw234FedH3wcYEj9hKOV2UM8Z Qz7XoO+fTojFiRrB8/y3nCY= X-Google-Smtp-Source: AJdET5fxuXPyyISVgL38EIVgvpxuQXy9vGA77fUEfgDyF7rAAe7Tn1Tei0uHIT+Wql81ubNpKxyofw== X-Received: by 2002:a81:86c7:: with SMTP id w190-v6mr4940182ywf.418.1541694576788; Thu, 08 Nov 2018 08:29:36 -0800 (PST) Received: from ?IPv6:2600:1700:1c60:5fe0:b953:4dbf:1e82:4293? ([2600:1700:1c60:5fe0:b953:4dbf:1e82:4293]) by smtp.gmail.com with ESMTPSA id 207-v6sm984716ywi.0.2018.11.08.08.29.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 08:29:35 -0800 (PST) From: Kanwei Li Message-Id: <36AB7969-AD14-4793-8C6E-21EDC293DE93@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_3215C389-41AC-4D5B-991C-2C298707EA81" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: BUG #15489: Segfault on DELETE Date: Thu, 8 Nov 2018 11:29:35 -0500 In-Reply-To: <0ff5c33e-43b9-d3e2-9f74-572b694b0ac1@lab.ntt.co.jp> Cc: =?utf-8?Q?Frederico_Costa_Galv=C3=A3o?= , Michael Paquier , pgsql-bugs@lists.postgresql.org, PG Bug reporting form To: Amit Langote References: <15489-f1158ddcc2584a8e@postgresql.org> <26334113-2b97-db62-b72c-8066c2dedbb5@lab.ntt.co.jp> <20181107071409.GA17169@paquier.xyz> <0ff5c33e-43b9-d3e2-9f74-572b694b0ac1@lab.ntt.co.jp> X-Mailer: Apple Mail (2.3273) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_3215C389-41AC-4D5B-991C-2C298707EA81 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I did do a VACUUM FULL on that one particular table as well, so that may = have been the command that fixed it, yes. I have just upgraded to PG 11.1 and will report if I see this again. = Thanks all! Kanwei > On Nov 7, 2018, at 8:33 PM, Amit Langote = wrote: >=20 > Thanks Frederico for your reply. >=20 > On 2018/11/08 10:10, Frederico Costa Galv=C3=A3o wrote: >> I stumbled upon this issue yesterday, and trying to reduce and = pinpoint >> it, I managed to get to this: >>=20 >> //start >> CREATE TABLE a ( >> id bigint >> ); >>=20 >> INSERT INTO a (id) VALUES (1); -- this id's value doesn't matter >>=20 >> ALTER TABLE ONLY a >> ADD CONSTRAINT a_pkey PRIMARY KEY (id); >>=20 >> CREATE TABLE b ( >> a_id bigint >> ); >>=20 >> ALTER TABLE ONLY b >> ADD CONSTRAINT b_a_id_fkey FOREIGN KEY (a_id) REFERENCES a(id); >>=20 >> ALTER TABLE a ADD x BOOLEAN NOT NULL DEFAULT FALSE; -- or TRUE, = doesn't >> matter >=20 > There it is. These are similar steps as I'd used to track down a bug > that's now fixed in 11.1. >=20 > = https://www.postgresql.org/message-id/9cb4aa1c-12ba-59c3-fd75-545fa90fb92f= %40lab.ntt.co.jp = >=20 > The bug had to do with foreign key trigger not getting a proper > representation of the tuple being deleted, considering the newly added = column. >=20 >> -- VACUUM FULL ANALYZE a; -- uncomment this to fix the bug >=20 > Ah, VACUUM FULL will rewrite the tuples such that they're not hit by = the > aforementioned bug. >=20 > So, if OP can tell that this is what happened in their case too, then = 11.1 > will have fixed the issue. >=20 > Thanks, > Amit --Apple-Mail=_3215C389-41AC-4D5B-991C-2C298707EA81 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 I did do a VACUUM FULL on that one particular table as well, = so that may have been the command that fixed it, yes.

I have just upgraded to PG 11.1 and = will report if I see this again. Thanks all!

Kanwei

On = Nov 7, 2018, at 8:33 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:

Thanks Frederico for your = reply.

On 2018/11/08 10:10, Frederico = Costa Galv=C3=A3o wrote:
I stumbled upon this issue = yesterday, and trying to reduce and pinpoint
it, I managed = to get to this:

//start
CREATE = TABLE a (
    id bigint
);
INSERT INTO a (id) VALUES (1); -- this id's = value doesn't matter

ALTER TABLE ONLY a
    ADD CONSTRAINT a_pkey = PRIMARY KEY (id);

CREATE TABLE b (
    a_id bigint
);

ALTER TABLE ONLY b
    ADD CONSTRAINT b_a_id_fkey = FOREIGN KEY (a_id) REFERENCES a(id);

ALTER = TABLE a ADD x BOOLEAN NOT NULL DEFAULT FALSE; -- or TRUE, doesn't
matter

There it is.  These are = similar steps as I'd used to track down a bug
that's now fixed in 11.1.
https://www.postgresql.org/message-id/9cb4aa1c-12ba-59c3-fd75-5= 45fa90fb92f%40lab.ntt.co.jp

The bug had to do with foreign key trigger not = getting a proper
representation of the tuple being = deleted, considering the newly added column.
-- VACUUM FULL ANALYZE a; -- = uncomment this to fix the bug

Ah, VACUUM FULL will rewrite the tuples such = that they're not hit by the
aforementioned bug.
So, if OP can tell that this is what happened in = their case too, then 11.1
will have fixed the = issue.

Thanks,
Amit

= --Apple-Mail=_3215C389-41AC-4D5B-991C-2C298707EA81--