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 1rqr2y-00ENy6-28 for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 09:00:12 +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 1rqr2v-00C5Cy-Ds for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 09:00:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqr2v-00C5Cq-2D for pgsql-hackers@lists.postgresql.org; Sun, 31 Mar 2024 09:00:09 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rqr2q-007mda-ML for pgsql-hackers@postgresql.org; Sun, 31 Mar 2024 09:00:08 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-513d4559fb4so3861101e87.3 for ; Sun, 31 Mar 2024 02:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711875603; x=1712480403; darn=postgresql.org; h=content-transfer-encoding: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=BeGQ3AKJpGuBbpQhgE9AA1CAhwS1ja7kLc7xqplb5Eo=; b=dHnCluiRMlPQKTAwROU2AQ2LmdfILyrES2vtNmDC4/nLXO8wUhFT2cAh+cK4wrEHzl qK7v+iGqFukYNIgdDh9C5+Nf+IJ0QBdG/tbcadszFulNFmL3x9J824QUNrYCtBMb5FlX bORnCMQ9leSWdJ6xBg8OdG0+y++FQeu+nz7xemFhQDFWfaGTE/ATTDzTeEnm0nMK08AE qflY5GXuggvz9PZJMhXhVRDaaslaYHiVH9N70QSb0MbsK7wUBEuIjQQQT94qFERmuVCu Oq2MzX/a/l/im3M+hEns0nmAdyATBxhXw28zDAtlc9zO/GlZx9qQuPicEBKzhZt4sa9q 9NUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711875603; x=1712480403; h=content-transfer-encoding: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=BeGQ3AKJpGuBbpQhgE9AA1CAhwS1ja7kLc7xqplb5Eo=; b=lb1TH447qhGXivfhYPNAh8wh18Jt3a4J1TgNGVxp8ygwypQif/bWwtMDwlKtL0xsyH QFvWlacAuOi63vtjQT7n+AlkVa4ak32pyOs/77gPh3wHl80TKAtXxAInCKpCynfxO4zi E1QxhPEKSk/U+HdDjvEsvk3ugi0rE7VU5SMmLeoQb1ZLIihAr3YWep8D5x9sX0oKZOGb v6YH4F/d22Z9/PRUWtCAl6+2Cc6SKZZdu7CXtWe/96BIWb+tliL3dzsmRh2QXCuDz+bX mepf5T1td1AZk5QtUPy7d4K9jwoR+sBro0xCj0SMaVvA06EMkR1XXyVZfUShY3w8A7El il9A== X-Forwarded-Encrypted: i=1; AJvYcCWUCn57V6HbSSFI86ippP3WuAmiXl8JAgjNwYqhWsSKMAT7jhToF5oQhnp75wRNi7EDIetTZxfk8qNIzTOVfYzyPObyRWqmBsxT2D8C X-Gm-Message-State: AOJu0Yz8l6Qhn027asRB0/Bk+SqbKIq75LFiVD+PTNmqJWTy+E3cwYGG 5Z1MGTfhURtmqkCc7wgSLG/WXO9hyYibOCjwcnABv9MeSsahJWxh X-Google-Smtp-Source: AGHT+IGtjxgEmwTwPfYjiRbHFSc96WBDBRfsIQt3ax8DSBLMPw07e2Q7FHOY6AE5hmae2fCfI8JhfQ== X-Received: by 2002:a05:6512:401a:b0:515:d13a:d1ec with SMTP id br26-20020a056512401a00b00515d13ad1ecmr7156775lfb.27.1711875602514; Sun, 31 Mar 2024 02:00:02 -0700 (PDT) Received: from [1.0.0.7] ([81.23.166.13]) by smtp.gmail.com with ESMTPSA id g1-20020ac24d81000000b00515c102c826sm1119454lfe.270.2024.03.31.02.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Mar 2024 02:00:02 -0700 (PDT) Message-ID: Date: Sun, 31 Mar 2024 12:00:00 +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: ALTER TABLE SET ACCESS METHOD on partitioned tables Content-Language: en-US To: Alvaro Herrera , Justin Pryzby Cc: Michael Paquier , Peter Eisentraut , Soumyadeep Chakraborty , Zhihong Yu , pgsql-hackers@postgresql.org, Ashwin Agrawal , vanjared@vmware.com References: <202403281558.xk5pgf7ur3dq@alvherre.pgsql> From: Alexander Lakhin In-Reply-To: <202403281558.xk5pgf7ur3dq@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Alvaro, 28.03.2024 18:58, Alvaro Herrera wrote: > Grumble. I don't like initialization at declare time, so far from the > code that depends on the value. But the alternative would have been to > assign right where this blocks starts, an additional line. I pushed it > like you had it. I've stumbled upon a test failure caused by the test query added in that commit: --- .../src/test/regress/expected/create_am.out      2024-03-28 12:14:11.700764888 -0400 +++ .../src/test/recovery/tmp_check/results/create_am.out 2024-03-31 03:10:28.172244122 -0400 @@ -549,7 +549,10 @@  ERROR:  access method "btree" is not of type TABLE  -- Other weird invalid cases that cause problems  CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x; -ERROR:  "pg_am" is not partitioned +ERROR:  deadlock detected +DETAIL:  Process 3076180 waits for AccessShareLock on relation 1259 of database 16386; blocked by process 3076181. +Process 3076181 waits for AccessShareLock on relation 2601 of database 16386; blocked by process 3076180. +HINT:  See server log for query details.  -- Drop table access method, which fails as objects depends on it  DROP ACCESS METHOD heap2;  ERROR:  cannot drop access method heap2 because other objects depend on it 027_stream_regress_primary.log contains: 2024-03-31 03:10:26.728 EDT [3076181] pg_regress/vacuum LOG: statement: VACUUM FULL pg_class; ... 2024-03-31 03:10:26.797 EDT [3076180] pg_regress/create_am LOG: statement: CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x; ... 2024-03-31 03:10:28.183 EDT [3076181] pg_regress/vacuum LOG: statement: VACUUM FULL pg_database; This simple demo confirms the issue: for ((i=1;i<=20;i++)); do echo "iteration $i" echo "VACUUM FULL pg_class;" | psql >psql-1.log & echo "CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x;" | psql >psql-2.log & wait done ... iteration 15 ERROR:  "pg_am" is not partitioned iteration 16 ERROR:  deadlock detected DETAIL:  Process 2556377 waits for AccessShareLock on relation 1259 of database 16384; blocked by process 2556378. Process 2556378 waits for AccessShareLock on relation 2601 of database 16384; blocked by process 2556377. HINT:  See server log for query details. ... Best regards, Alexander