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 1rwNoV-001Hvz-Ej for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2024 15:00:07 +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 1rwNoT-00DgpE-RA for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2024 15:00:05 +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 1rwNoT-00DgoN-HU for pgsql-hackers@lists.postgresql.org; Mon, 15 Apr 2024 15:00:05 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rwNoR-00162O-5w for pgsql-hackers@lists.postgresql.org; Mon, 15 Apr 2024 15:00:04 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d094bc2244so38103621fa.1 for ; Mon, 15 Apr 2024 08:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713193202; x=1713798002; darn=lists.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=rZw8oGE330ZsBRNf+MdYO1N3UfaBo5wAEFCg7GmO/tE=; b=apIb9eH7ViB5qZmc1DSic5R3MqJv5sco8/52iJ4yd4MDVB/NOB6yJ2A1OGleX1Gu/O UkKXS5c7BgurOt7tauxlR9nGMGxe5ihcgC4zdNwqFuIL18mmKdp4MtXIzXZjDjfXbUM4 Nr/LnKfeZ91OoD9+DlMUjnuCZTkUuH2/XTkYVmFJb814nG6QPDxZ/eUMIxPs3dw6TPjM oM0WRYshFQ2NTCYt1cho7Tz5SpjfXusgu6sb2OAIuMfpMrOuU6zpiKNcOUuu1Ssi6q9L wmWDeF3WoYYYQn7EBMNogfcbummj/WSbMvpdIsFE7UMY9e8toFw+CSP0HlXKVbL8aL+h kSTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713193202; x=1713798002; 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=rZw8oGE330ZsBRNf+MdYO1N3UfaBo5wAEFCg7GmO/tE=; b=pD7RYm/ztUvV36AKSwEiSr5uNjUOG9avc6AdVeVa3OLfmmlqopv/mj6Fqgh9W4GGxG lTXEN172yexHJ0z05kh5T2j3rMGf3rysfflqp1c/3Bq0Dx2IGS+7oQ4LJl/VuLwknjbH K7Txk34g9HgiLdKVFJ3k0QVYNchplsEOc5u9MhCCO7HiatII69JAHATslArTBuJi3kyl oh/3orfs9FqqKQYx+FiVxFVrl5R53LbBBT+29j9NV3INfSZbt5h+RlVsxKhQ3vdErwwc PeeY3B4G/qApjHxlHFrfmmwXMT4uBrrWEN5VJfqEa6R/0BtnzF90CZ7q2S94HekklFbo N3tA== X-Forwarded-Encrypted: i=1; AJvYcCV2QJbbfvM33rJlz8rMAT/DXQ+YMYQOwZgT/mJwvDtj0Vk3/njxlYCP3wPfN833DaLJMy95okaC4GXTDuAm3N7kvv1W78D4o2+WC0HES9krd9hk X-Gm-Message-State: AOJu0YyoQ9fKUX7SEPXMnjKXX9Erd+7lV40CSLm1Uwe5gRNVsFaJnxIb tShQs9KilM+Vg7DRhXFVKe6LRRrlDhTxGLoN88ZBFfZs100u/czU X-Google-Smtp-Source: AGHT+IEB5lNIev8k/3ncMxdxdMLzNOYCkrpt1KMaqO6f/AH3SCTME+y3iqlglp5bVeQzgQNWhpmpCA== X-Received: by 2002:a19:6a0d:0:b0:515:a417:334 with SMTP id u13-20020a196a0d000000b00515a4170334mr5862881lfu.46.1713193201669; Mon, 15 Apr 2024 08:00:01 -0700 (PDT) Received: from [1.0.0.7] ([91.185.79.145]) by smtp.gmail.com with ESMTPSA id z18-20020a056512371200b00518cf9ca6besm454835lfr.232.2024.04.15.08.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Apr 2024 08:00:01 -0700 (PDT) Message-ID: <7edb8a57-5e50-dd77-7953-454d6686779e@gmail.com> Date: Mon, 15 Apr 2024 18: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: Add SPLIT PARTITION/MERGE PARTITIONS commands Content-Language: en-US To: Robert Haas , Alexander Korotkov Cc: Dmitry Koval , PostgreSQL Hackers References: <86bfd241-a58c-479a-9a72-2c67a02becf8@postgrespro.ru> <0f655bcd-6487-4179-f9cf-c248efbad510@gmail.com> From: Alexander Lakhin In-Reply-To: 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 Robert, 15.04.2024 17:30, Robert Haas wrote: > On Sat, Apr 13, 2024 at 6:05 AM Alexander Korotkov wrote: >> Please, find a my version of this fix attached. I think we need to >> check relpersistence in a similar way ATTACH PARTITION or CREATE TABLE >> ... PARTITION OF do. I'm going to polish this a little bit more. > + errmsg("\"%s\" is not an ordinary table", > > This is not a phrasing that we use in any other error message. We > always just say "is not a table". Initially I was confused by that message, because of: CREATE TABLE t (i int) PARTITION BY RANGE (i); CREATE FOREIGN TABLE ftp_0_1 PARTITION OF t   FOR VALUES FROM (0) TO (1)   SERVER loopback OPTIONS (table_name 'lt_0_1'); CREATE FOREIGN TABLE ftp_1_2 PARTITION OF t   FOR VALUES FROM (1) TO (2)   SERVER loopback OPTIONS (table_name 'lt_1_2'); ALTER TABLE t MERGE PARTITIONS (ftp_0_1, ftp_1_2) INTO ftp_0_2; ERROR:  "ftp_0_1" is not a table (Isn't a foreign table a table?) And also: CREATE TABLE t (i int) PARTITION BY RANGE (i); CREATE TABLE tp_0_1 PARTITION OF t   FOR VALUES FROM (0) TO (1); CREATE TABLE t2 (i int) PARTITION BY RANGE (i); ALTER TABLE t MERGE PARTITIONS (tp_0_1, t2) INTO tpn; ERROR:  "t2" is not a table (Isn't a partitioned table a table?) And in fact, an ordinary table is not suitable for MERGE anyway: CREATE TABLE t (i int) PARTITION BY RANGE (i); CREATE TABLE tp_0_1 PARTITION OF t   FOR VALUES FROM (0) TO (1); CREATE TABLE t2 (i int); ALTER TABLE t MERGE PARTITIONS (tp_0_1, t2) INTO tpn; ERROR:  "t2" is not a partition So I don't think that "an ordinary table" is a good (unambiguous) term either. Best regards, Alexander