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 1rv677-009fpq-VM for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2024 01:54:02 +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 1rv675-008BxV-Ou for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2024 01:53:59 +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 1rv675-008BxN-Dk for pgsql-hackers@lists.postgresql.org; Fri, 12 Apr 2024 01:53:59 +0000 Received: from mail-yb1-xb2f.google.com ([2607:f8b0:4864:20::b2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rv672-002Qzy-5A for pgsql-hackers@lists.postgresql.org; Fri, 12 Apr 2024 01:53:58 +0000 Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-dccb1421bdeso446489276.1 for ; Thu, 11 Apr 2024 18:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712886835; x=1713491635; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZCh6iaBYXeeH5O593oJE2UmMDGBMkip+ETjOy30FTeQ=; b=GDTYU9tVenfY160nPTLjpa3pYN47EBjuaHdamaYC0wEouX9y8CKsOjqabr0oQQSAoL Et2T7H9XErsKweCpEO9Y59rEFqsDSQWCdtQkkovB38UtNhjkoc8yKuOqmpeRZBdHr9GW cXqd36jW9zWzTkHqMz37QUeLBfBL24S3Kv2xGiKRB4qsOV/e6FFgehwn5pxgoVmufQQ7 nSsg247FUwZmFKA7YOCzqZ1etNVmmTbUKFm2GP6TV+KynJ3O/gbBjiBfulMJt0yz3dKV 7RxQchKliKO1Y/jILf4rgrgtSsPW/BLL5S8m2E0BMT6a2WhlroO36oh+GYcYQEk37xUO S1QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712886835; x=1713491635; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZCh6iaBYXeeH5O593oJE2UmMDGBMkip+ETjOy30FTeQ=; b=BYygN8c1ACXlKd/FCVOs5SD2BWVTTVZZREWaLFLIES0dV3WwCxe1S4m+qqNx+eYu6q o/7KcU+t02gdbMOqRShPFUF3oD++0Hne/V+3+aLb4a5Gez7G25N0C9GLgXa3JAGn87yf CAW+G/XRMc/8F2Z8ChdpWsj7CRoQBJcP4c4hCRZG67KoASjy5M8rZuMNX/+RiwcwSnMZ QtYuUf0B8bQF5TEQHQWax1vu/29fqsDO4oc3qGhNTNJO35SZe6SL+8iOTtk3XywFJvRx 0ODT3c5DPEG7KVqARq8566UPiWSM5/hf/hLeI6qVWAfJUlqpbjaDHapo5u6c77aXoUN2 vyfg== X-Forwarded-Encrypted: i=1; AJvYcCW76H1jC+gFe7pAuTHwNCrysJurdWaIOZqHhcQRm8dYgCRMKkto93XNNeiV0miBTIj30kJtFFFgB0UK5jM69/RhduDJSlMgwrrqHMpttR458ol6 X-Gm-Message-State: AOJu0YxWgn1Wmx2xouYJ/A9FgQfxIp/fJUz1TFNXvYAPofcgGspRoodH DSwCiH//ql9O8jHZL+sh0Y004qTPUbAp+Rbq8WTVxrH99vwwBYgx2nYKfCiY3LlmCY0Mpsf6k4f paDTgOmpgRFAEBRmK3NiaJBSkqnE= X-Google-Smtp-Source: AGHT+IGZlzSsTGWacePOHrkf2wNT/JBKGMVxL8iBX0SaEp1opS8XCnp4llJOkrcCshQAPpHtjvcoMreBFK2Mr36i8FU= X-Received: by 2002:a25:bcca:0:b0:de0:ea71:9ec9 with SMTP id l10-20020a25bcca000000b00de0ea719ec9mr1320224ybm.1.1712886835312; Thu, 11 Apr 2024 18:53:55 -0700 (PDT) MIME-Version: 1.0 References: <3a4b9c1c-3edf-4e29-9629-b4113aefb0f3@postgrespro.ru> <28ed1ee0-749d-9838-955e-abff42fc44be@gmail.com> <86bfd241-a58c-479a-9a72-2c67a02becf8@postgrespro.ru> <0f655bcd-6487-4179-f9cf-c248efbad510@gmail.com> In-Reply-To: <0f655bcd-6487-4179-f9cf-c248efbad510@gmail.com> From: Alexander Korotkov Date: Fri, 12 Apr 2024 04:53:43 +0300 Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Alexander Lakhin Cc: Dmitry Koval , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 11, 2024 at 8:00=E2=80=AFPM Alexander Lakhin wrote: > 11.04.2024 16:27, Dmitry Koval wrote: > > > > Added correction (and test), see v3-0001-Fix-for-SPLIT-MERGE-partitions= -of-temporary-table.patch. > > > > Thank you for the correction, but may be an attempt to merge into implici= t > pg_temp should fail just like CREATE TABLE ... PARTITION OF ... does? > > Please look also at another anomaly with schemas: > CREATE SCHEMA s1; > CREATE TABLE t (i int) PARTITION BY RANGE (i); > CREATE TABLE tp_0_2 PARTITION OF t > FOR VALUES FROM (0) TO (2); > ALTER TABLE t SPLIT PARTITION tp_0_2 INTO > (PARTITION s1.tp0 FOR VALUES FROM (0) TO (1), PARTITION s1.tp1 FOR VAL= UES FROM (1) TO (2)); > results in: > \d+ s1.* > Did not find any relation named "s1.*" > \d+ tp* > Table "public.tp0" > ... > Table "public.tp1" +1 I think we shouldn't unconditionally copy schema name and relpersistence from the parent table. Instead we should throw the error on a mismatch like CREATE TABLE ... PARTITION OF ... does. I'm working on revising this fix. ------ Regards, Alexander Korotkov