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.94.2) (envelope-from ) id 1rQOFt-000taP-Pu for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jan 2024 09:00:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rQOFs-001R4N-Fs for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jan 2024 09:00:08 +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.94.2) (envelope-from ) id 1rQOFs-001R4F-19 for pgsql-bugs@lists.postgresql.org; Thu, 18 Jan 2024 09:00:08 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rQOFp-0027p3-57 for pgsql-bugs@lists.postgresql.org; Thu, 18 Jan 2024 09:00:06 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2cd2f472665so127343401fa.2 for ; Thu, 18 Jan 2024 01:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705568403; x=1706173203; darn=lists.postgresql.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=QWnLcPi1OXEbckrgdM7AHbwaD7NtIKY/OuwY9aIYMbg=; b=DjalH+Cl1kc1Y7qBMd7GUmx+XA6lApqUZnynR6YoHYmWieNvKI9RuhCaj9aROhzV99 0+bZvg/VqKCceun/4y3nSn8QyJZ8WZQJaieRv/sgjDKGqEU7D1x0WzAUCjuLmmQSwlRg 2cCoMtz5Qt7gcj9XvzK8blsXXdIuXMgUUHlbDgbJL7YW2W/2L+lN+O4o8ncnkbWa/nGF NOrcc8yPRMP0srDaLBnJfkNfojmKMTvUUv4XZmyV/0qAfdso/azYPU4f8F8DpFuwNL6g ekWgvK1uUZ8/x5VmpCkDmWP6Vwq5yydLF50odtcRNHa+0T4pBJQHey+xIdow9tZZjOos 2dPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705568403; x=1706173203; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QWnLcPi1OXEbckrgdM7AHbwaD7NtIKY/OuwY9aIYMbg=; b=dMNIiB6E2XDAVjwtEtzWzGVFlaN48holySn7u2MCkOxCz5IMES+Y+QvzQ6hhL8RjZR SZFkalMwtfLeR18aaaRh03GtG+JLrTLTJv5o95NhLYsa4qcIo3Ck8mL3Lc8dyfXjoH+s TcXZB6s87ZGYvkO+jqCHoBGzxJw1kCFJoqtn/7AHZjIMiixtIhuchWfaeFRSb27rt7ml ADDuCVaiS+55S3ANnHUA0fXye74Z7JMqSwcbV4w7PH88Jt2bFcB4lEovT6haD4nILT0w eVU0hvoP5HXSsQ0U5GHDmQ5PVSx7JM/u0T5C5occcivd+Cky2UKZPqERAhQojxgx/g9X GcEQ== X-Gm-Message-State: AOJu0YwN2/xpF1D0+zL77mLnnuQsDm67siF1aEVDCq4XEnqBEyBRqhyu 3J3ErvPEhxpD6yDvg13i+/7k2YsDd9DbMN7WNQWXD+IsOmIr2wAa X-Google-Smtp-Source: AGHT+IF3E67EK/MiNHWon2bOfKB+9Cw9z/OUZqKy30c33yCD0aEadHDbzyF1wPX9FShjL2A3mZBxoQ== X-Received: by 2002:a2e:9602:0:b0:2cd:230c:cc40 with SMTP id v2-20020a2e9602000000b002cd230ccc40mr271165ljh.42.1705568402936; Thu, 18 Jan 2024 01:00:02 -0800 (PST) Received: from [1.0.0.7] ([91.185.77.50]) by smtp.gmail.com with ESMTPSA id b19-20020a2e9893000000b002cd6413f60dsm2186109ljj.83.2024.01.18.01.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jan 2024 01:00:02 -0800 (PST) Content-Type: multipart/alternative; boundary="------------ja1jEB3qyBCGgNa0A0hTPZNE" Message-ID: <38de09cc-70f3-28ee-fe67-ae13cba23e61@gmail.com> Date: Thu, 18 Jan 2024 12:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #18297: Error when adding a column to a parent table with complex inheritance Content-Language: en-US To: Tender Wang , Richard Guo Cc: pgsql-bugs@lists.postgresql.org References: <18297-b04cd83a55b51e35@postgresql.org> From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------ja1jEB3qyBCGgNa0A0hTPZNE Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Tender Wang and Richard, 17.01.2024 18:03, Tender Wang wrote: > Thanks for reviewing the patch. > The attached v2 patch includes all review advices. > > -- > Tender Wang > OpenPie: https://en.openpie.com/ > > Richard Guo 于2024年1月17日周三 19:54写道: > > > Indeed.  We may update the same child column multiple times, but there > is no CommandCounterIncrement between.  Nice catch and +1 to the fix. > > To nitpick, how about go with the comment as > >     /* Make sure the child column change is visible */ > > which seems clearer. > > Also I think it'd be better to include a blank line before and after the > new CommandCounterIncrement statement. > > Also I suggest to drop the new added tables after we've run ALTER TABLE > in the test case. > > Thanks > Richard > Thank you for working on this! (Maybe it's possible to slightly modify an existing hierarchy with tables a, b, c in inherit.sql for the purpose of the check added.) I've found another situation where the same error is produced: CREATE ROLE u; DROP ROLE u, u; ERROR:  tuple already updated by self Perhaps, you would like to fix it in passing too. I've rechecked all the other object types, that can be DROPped with a list (namely, AGGREGATE, DOMAIN, EXTENSION, FOREIGN DATA WRAPPER, FOREIGN TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, OPERATOR, PROCEDURE, ROUTINE, SEQUENCE, SERVER, STATISTICS, TABLE, TYPE, VIEW), and found that all of these handle such duplicate entries with no error. Best regards, Alexander --------------ja1jEB3qyBCGgNa0A0hTPZNE Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hello Tender Wang and Richard,

17.01.2024 18:03, Tender Wang wrote:
Thanks for reviewing the patch.
The attached v2 patch includes all review advices.

--
Tender Wang
OpenPie:  https://en.openpie.com/

Richard Guo <guofenglinux@gmail.com> 于2024年1月17日周三 19:54写道:

Indeed.  We may update the same child column multiple times, but there
is no CommandCounterIncrement between.  Nice catch and +1 to the fix.

To nitpick, how about go with the comment as

    /* Make sure the child column change is visible */

which seems clearer.

Also I think it'd be better to include a blank line before and after the
new CommandCounterIncrement statement.

Also I suggest to drop the new added tables after we've run ALTER TABLE
in the test case.

Thanks
Richard

Thank you for working on this!

(Maybe it's possible to slightly modify an existing hierarchy with tables
a, b, c in inherit.sql for the purpose of the check added.)

I've found another situation where the same error is produced:
CREATE ROLE u;
DROP ROLE u, u;
ERROR:  tuple already updated by self

Perhaps, you would like to fix it in passing too. I've rechecked all the
other object types, that can be DROPped with a list (namely, AGGREGATE,
DOMAIN, EXTENSION, FOREIGN DATA WRAPPER, FOREIGN TABLE, FUNCTION, INDEX,
MATERIALIZED VIEW, OPERATOR, PROCEDURE, ROUTINE, SEQUENCE, SERVER,
STATISTICS, TABLE, TYPE, VIEW), and found that all of these handle
such duplicate entries with no error.

Best regards,
Alexander
--------------ja1jEB3qyBCGgNa0A0hTPZNE--