Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kE4rI-0002IX-OZ for pgsql-novice@arkaria.postgresql.org; Fri, 04 Sep 2020 06:06:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kE4rH-0003kI-Hm for pgsql-novice@arkaria.postgresql.org; Fri, 04 Sep 2020 06:05:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kE4rH-0003kA-Ak for pgsql-novice@lists.postgresql.org; Fri, 04 Sep 2020 06:05:59 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kE4rF-0008GK-2X for pgsql-novice@lists.postgresql.org; Fri, 04 Sep 2020 06:05:58 +0000 Received: by mail-pf1-x429.google.com with SMTP id u128so4023713pfb.6 for ; Thu, 03 Sep 2020 23:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=meDQxa67l6sZCvTg0Qr5a+cw9IPbwvaQMeGpJXkRi0c=; b=BZKMOZrZVvFfuw8QAoAnRgGTTfOh5758MjKAyzVE+Ki8ZujVHydviDg4EdgnZX6SCB Hk1IHLQjvWMnnS0ivbCjF0F4yW9DlcBAlqM8UFkpQ5YtERWkG5zev/tYOp4X1SlLcxhh 1WjXPHuOR4AHZtwHqIAtzHoSHkKpVMfSGfQuAJcLHWbbXwakfSoO0Nsgulfb5eWa6web LvgYdGGAYrei0HJLDl5p/5aN8UOmmcJT/P/tHqLW8XzTiPVIgJJ4JNjG362M6F5YXOkC pS6iOZ4zpanf9111lFARF8fynEJ+1rPGrxljcZhZ35S7C6/irr9LyJF8E7wzr6hK2vj+ h3Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=meDQxa67l6sZCvTg0Qr5a+cw9IPbwvaQMeGpJXkRi0c=; b=Cp2DqiQ4YMGofXy5zF1xU4B8bNKCYi+J3z+gVKvEfN6XwRHrdstipwdMeA8i1xyiX0 eLpzpgwQb5vDEhIiV1qI2en34d4/waf64tN90T78SG6PsYColFNFX5RnXpurenvONEH6 NGR4ru5zc4X9OXw6dDi9/I9BCjLli2m6QZJskUKx7BfLuFJ9fCbyUVd2FuB8f7m4rcih RmL9sCsYgAf9S6rAsivUG8FmV8W+V+w6yzgxLKWhcuyux8ZDD3w/0O0umFYMCcbxNqSm fgHqGIYpnqDL51CqXHPamvujkXi5u7bJ+vfYx07RTGPYirS7oK+WExPoliCE7hubT47e JTtw== X-Gm-Message-State: AOAM532kbLviYWt1qYUYJP8RU4e1eZR4u4ysD8qVjLmFkkVa7EjOmWAN nwyTX4Y3WZArMcpyLS+jKe1s9XcNFXh0MQ== X-Google-Smtp-Source: ABdhPJzCM9dxZIiPrOOS2nmZhllv9Cr8DUdKqIFG73ZlrSCF9DQn5+t2Qppy1AUyjnhI+em/PCsN9A== X-Received: by 2002:a65:690f:: with SMTP id s15mr5928633pgq.124.1599199554512; Thu, 03 Sep 2020 23:05:54 -0700 (PDT) Received: from 192-168-1-111.tpgi.com.au (203-219-142-167.static.tpgi.com.au. [203.219.142.167]) by smtp.gmail.com with ESMTPSA id a7sm5401320pfd.194.2020.09.03.23.05.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 23:05:54 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Confusions regards serializable transaction From: Hannah Huang In-Reply-To: Date: Fri, 4 Sep 2020 16:05:50 +1000 Cc: pgsql-novice@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <31DA4198-1B8E-4999-9A19-49AD87F36BDB@gmail.com> References: To: Peter Geoghegan X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 4 Sep 2020, at 2:21 pm, Peter Geoghegan wrote: >=20 > On Thu, Sep 3, 2020 at 5:20 PM Hannah Huang = wrote: >> I=E2=80=99m confused about what will trigger the serializable error. = My test environment is PG v12. >>=20 >> This is how you can produce the test table: >=20 > Serializable isolation level promises to emulate serial transaction > execution for all committed transactions. I believe that your example > does not show behavior that breaks that specific promise. >=20 > --=20 > Peter Geoghegan Hi Peter, Thank you very much for replying my question. My confusion is actually: Transaction B updated the n value of id 2, while transaction A needs to = update n value for id 1 referencing the n value of id 2. If the transaction is executed in a serialized way, then the n value of = id 2 will be changed in transaction B first, and the change will be = reflected in the value of id 1in transaction A. However, the two = transactions are not executed concurrently - transaction A executed = successfully without seeing changes made in transaction B. Is that a = break of serializable isolation level? Thanks, Hannah=