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 1s1b5F-00DNVK-61 for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 00:10:57 +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 1s1b5B-002oN7-MZ for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 00:10:54 +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 1s1b5B-002oMz-8n for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 00:10:54 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1b57-000l6E-Af for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 00:10:53 +0000 Received: from [172.30.2.66] (unknown [172.30.2.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: d.koval@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 52219E20520; Tue, 30 Apr 2024 03:10:47 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1714435847; bh=P+Aeb6gW/vAlUduANW/EQTC4AbyYa3Ge9GmkDxvEUEE=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=OayJZAa62Tnb6tHct0cz0VsSVqgvmlKeGjKy1RqLbdqsB8TAObcSQLkWThXO14wmh +Z5xiw1GvuiFxtmter4PFxhzBudNeKa/8WDCQ317600QGFM+7MSZoya+na5LtYic0V aMeSW3ZS3MGe3jVHk78FMfDcWfXw3wgf9YJfd1pZKdPxvFKtxn2KiSBqsIcVcGTCXe LE1uYM0erNZbpUqId926209SIChikNMMgSKZ1S0YYDEei0J4hpP54CGXcMNHXOCKgA G5ARtUxooFswAt1YvC1SLYbyNMt8y0nKuhFyPy1PhuJ4SdKKDDMJHUp7/5pf95eG8A N/199tUz0J+Jg== Content-Type: multipart/mixed; boundary="------------HTcqOdE3J7J4kFhY0XcDbU9s" Message-ID: Date: Tue, 30 Apr 2024 03:10:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Alexander Lakhin , Alexander Korotkov Cc: Robert Haas , PostgreSQL Hackers References: <0f655bcd-6487-4179-f9cf-c248efbad510@gmail.com> <56e0000c-6b39-44ce-90b4-d3c3062e408c@postgrespro.ru> <5dee3937-8e9f-cca4-11fb-737709a92b37@gmail.com> Content-Language: en-US From: Dmitry Koval In-Reply-To: X-KSMG-AntiPhishing: NotDetected, bases: 2024/04/29 22:55:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/04/29 17:44:00 #25024213 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------HTcqOdE3J7J4kFhY0XcDbU9s Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi! 1. 29.04.2024 21:00, Alexander Lakhin wrote: > I still wonder, why that constraint (now with a less questionable name) is > created during MERGE? The SPLIT/MERGE PARTITION(S) commands for creating partitions reuse the existing code of CREATE TABLE .. LIKE ... command. A new partition was created with the name "merge-16385-26BCB0-tmp" (since there was an old partition with the same name). The constraint "merge-16385-26BCB0-tmp_i_not_null" was created too together with the partition. Subsequently, the table was renamed, but the constraint was not. Now a new partition is immediately created with the correct name (the old partition is renamed). 2. Just in case, I am attaching a small fix v9_fix.diff for situation [1]. [1] https://www.postgresql.org/message-id/0520c72e-8d97-245e-53f9-173beca2ab2e%40gmail.com -- With best regards, Dmitry Koval Postgres Professional: http://postgrespro.com --------------HTcqOdE3J7J4kFhY0XcDbU9s Content-Type: text/plain; charset=UTF-8; name="v9_fix.diff" Content-Disposition: attachment; filename="v9_fix.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3BhcnNlci9wYXJzZV91dGlsY21kLmMgYi9zcmMv YmFja2VuZC9wYXJzZXIvcGFyc2VfdXRpbGNtZC5jCmluZGV4IGZlZjA4NGY1ZDUuLmU5MThh NjIzYzUgMTAwNjQ0Ci0tLSBhL3NyYy9iYWNrZW5kL3BhcnNlci9wYXJzZV91dGlsY21kLmMK KysrIGIvc3JjL2JhY2tlbmQvcGFyc2VyL3BhcnNlX3V0aWxjbWQuYwpAQCAtMzQ0Niw2ICsz NDQ2LDExIEBAIGNoZWNrUGFydGl0aW9uKFJlbGF0aW9uIHJlbCwgT2lkIHBhcnRSZWxPaWQp CiAJCQkJCQlSZWxhdGlvbkdldFJlbGF0aW9uTmFtZShwYXJ0UmVsKSwKIAkJCQkJCVJlbGF0 aW9uR2V0UmVsYXRpb25OYW1lKHJlbCkpKSk7CiAKKwkvKiBQZXJtaXNzaW9ucyBjaGVja3Mg Ki8KKwlpZiAoIW9iamVjdF9vd25lcmNoZWNrKFJlbGF0aW9uUmVsYXRpb25JZCwgUmVsYXRp b25HZXRSZWxpZChwYXJ0UmVsKSwgR2V0VXNlcklkKCkpKQorCQlhY2xjaGVja19lcnJvcihB Q0xDSEVDS19OT1RfT1dORVIsIGdldF9yZWxraW5kX29ianR5cGUocGFydFJlbC0+cmRfcmVs LT5yZWxraW5kKSwKKwkJCQkJICAgUmVsYXRpb25HZXRSZWxhdGlvbk5hbWUocGFydFJlbCkp OworCiAJcmVsYXRpb25fY2xvc2UocGFydFJlbCwgQWNjZXNzU2hhcmVMb2NrKTsKIH0KIAo= --------------HTcqOdE3J7J4kFhY0XcDbU9s--