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 1ruWcZ-005wEI-Pl for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2024 12:00:08 +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 1ruWcY-001ext-TT for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2024 12:00:06 +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 1ruWcY-001ewu-Jd for pgsql-hackers@lists.postgresql.org; Wed, 10 Apr 2024 12:00:06 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ruWcV-000Brx-Fw for pgsql-hackers@lists.postgresql.org; Wed, 10 Apr 2024 12:00:05 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d895e2c6efso36264991fa.0 for ; Wed, 10 Apr 2024 05:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712750402; x=1713355202; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VV89Gu4aQ4WwwJv8WNXH8SI7YKXoI+2VfS1NQEN4O88=; b=RlAodaDLLtV9dErRu2LfkHIsTnt+Yip5NkzBncTtsDDv6oLGKqdfzUZIBdyNhvXMEn RQZVK2NPjMCyILJ9b07vL7YqmLfwTo+c+vP3j9Jx/s/UbLq8olb/5RKkR3moM/aB6GOi UXDw7Hvqb7x/2Ck8dGU0sMyR+U1GqAg1t1EjiFiK4O65uE50dc9lQrM6VKZvt8IUo4a8 jb2ICywUI9vOg5t5WnXvrFTCXPfHPuF0uW/kUcZCHGCUQyzVVlvx07SbjIUe+DUig9PY ew2A576V5pzQs4NwPoIL5oZOyzSwMcxQWt+nWTDwV+eduQTd5QHAnNjg7sTo7vsuadGk oDyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712750402; x=1713355202; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VV89Gu4aQ4WwwJv8WNXH8SI7YKXoI+2VfS1NQEN4O88=; b=QroT5mLjq5w2LENM2Q10kSk5N13sD1HAU9DOzWQVzEep4yR3Vaa8+H/FEegqDBuk5J COjSCNYiwYni0CyiyESr6F+poSj1A7U4YIdsyK19Qu7VIqjfebBKcSFRn5fI1o7iKQut JkiYaLgrJFpFa2Wha0VM5D5te2ktxAcVZBlEGGX232JPaYgs58VC8QBmcXftyLUtOLPi vmKuwaEk9nupZitc2prlZ2kicN1staFXPy9lwHkQiYv5xIfCl1QNDoK9s3XOQFHZvtmY q7Lh59dSSs4qxOyfFXRFSeCHfMovSNW74lnlA3bkZzUJlFtmS51T3EFulOZAFQXPXdiJ y0Cg== X-Gm-Message-State: AOJu0Yz1SLHd3CtcTMkwGK+JRykej8yz0zdnxc0pNlfbdFAYCE1uypYa JzQgEgSN5MNzz/FQpmRlF3qsLfDfuePp5T8/34Xe2G2ps0903HXr X-Google-Smtp-Source: AGHT+IFdZu566sN5vX8zjvuqOyJFOkWijf8eeMbW3fV6aUUdzoqQ8e1amnXItxcLfyz0RWHHivScLA== X-Received: by 2002:a2e:6a0e:0:b0:2d6:d9cd:ac8c with SMTP id f14-20020a2e6a0e000000b002d6d9cdac8cmr1649724ljc.43.1712750402262; Wed, 10 Apr 2024 05:00:02 -0700 (PDT) Received: from [1.0.0.7] ([91.185.79.145]) by smtp.gmail.com with ESMTPSA id z25-20020a2e9b99000000b002d869fec5ebsm1734039lji.79.2024.04.10.05.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Apr 2024 05:00:01 -0700 (PDT) Message-ID: Date: Wed, 10 Apr 2024 15: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 From: Alexander Lakhin To: Alexander Korotkov , Dmitry Koval Cc: PostgreSQL Hackers , Richard Guo References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org> <171085858750.2046434.12246066729700037354.pgcf@coridan.postgresql.org> <909e16b4-9eda-435c-b033-8294ae4adc05@postgrespro.ru> <3a4b9c1c-3edf-4e29-9629-b4113aefb0f3@postgrespro.ru> <28ed1ee0-749d-9838-955e-abff42fc44be@gmail.com> 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 10.04.2024 12:00, Alexander Lakhin wrote: > Hello Alexander and Dmitry, > > 10.04.2024 02:03, Alexander Korotkov wrote: >> Thank you.  I've pushed this fix with minor corrections from me. > Please look at another anomaly with MERGE. CREATE TEMP TABLE t (i int) PARTITION BY RANGE (i); CREATE TABLE tp_0_2 PARTITION OF t   FOR VALUES FROM (0) TO (2); fails with ERROR:  cannot create a permanent relation as partition of temporary relation "t" But CREATE TEMP TABLE t (i int) PARTITION BY RANGE (i); CREATE TEMP TABLE tp_0_1 PARTITION OF t   FOR VALUES FROM (0) TO (1); CREATE TEMP TABLE tp_1_2 PARTITION OF t   FOR VALUES FROM (1) TO (2); ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; succeeds and we get: regression=# \d+ t*                                     Partitioned table "pg_temp_1.t"  Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description --------+---------+-----------+----------+---------+---------+-------------+--------------+-------------  i      | integer |           |          |         | plain |             |              | Partition key: RANGE (i) Partitions: tp_0_2 FOR VALUES FROM (0) TO (2)                                          Table "public.tp_0_2"  Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description --------+---------+-----------+----------+---------+---------+-------------+--------------+-------------  i      | integer |           |          |         | plain |             |              | Partition of: t FOR VALUES FROM (0) TO (2) Partition constraint: ((i IS NOT NULL) AND (i >= 0) AND (i < 2)) Best regards, Alexander